Login Stats "false-positive"?
This deals with login stats... (I've not done any coding yet - just trying to hypothesize first... but will use CF queries)
I'm sure there's a way to do this but can't quite figure it. I know it's easy enough to do a database row count or add the 'number fields' in a
database column for a total, but - how to do this without getting a "false positive" as per below?
Goal: To find the name of the school with the lowest number of Teacher logins.
The LoginCounter database field is set up as a 'number field' and adds an increment of 1 each time a teacher logs in to the site. (for my counter code
to work, this field starts with a default of 1). I have a SchoolName field in the TeacherID row, associating a Teacher with a school and, currently
there are 5 schools... I don't have to do any kind of table join - all fields are in one table.
No problem with pulling a total on the total number of logins of ALL teachers in ALL schools or All teachers in THIS school and then comparing this
number between the different schools.
But I can see more than one "false positive" per the following:
Say, there are 20 TeacherID in School_01 and 40 TeacherID in School_02. And say, totaling the LoginCounter column shows a total of 30 teacher logins
for School_01 and 50 teacher logins for School_02. By just adding up the total LoginCounter per school would show that School_01 has the lowest number
of teacher logins.
However, you have to take into consideration that some teachers may have only logged in once (or rather, none)... as well as considering that, say, 15
teachers out of 20 teachers in School_01 may have logged in a total of 30 times... when, at School_02, one teacher may have logged in 35 times along
with 5 of his colleagues logging in once apiece. In this scenario School_01 still has the lowest total of loggins but School_02 actually has the poorer
score of total teacher logins.
How would I average the number of teachers per school with the total number of schools with the number of logins per teacher to
obtain an accurate count of actual teacher logins? An "over-zealous" teacher, logging in way more numerous times than other teachers would throw the
final figure off...
Is it even possible to obtain an accurate comparison the way I have the database fields set up? I guess (the way I have it set up) I can only consider the LoginCounter fields that have only a "1" (the number of teachers who have never logged in) and get an average to compare between schools. But if all the teachers in a school have logged in numerous times, I'll have to find some kind of "representative number" based on some kind of average between the number of teachers in a school and (the part I can't figure) some kind of average of each teacher's login total.
In retrospect, after re-reading this before posting... I guess I have only two things here: (1) The total number of logins per school (disregarding an
'over-zealous' teacher and, (2) a count on teachers who have never logged in, compared between schools. I just don't know if I can get an accurate
count for "Lowest Number of Logins School" if all teachers in a school have logged in numerous times... Is there a way to get some kind of average, or rather some 'representative number' based on the number of teachers per school and each one's login total? Or, maybe each teacher's LoginCount doesn't even come into play here... (I know this sounds a bit confusing.)
- ed
