From: P G. L. <gl...@um...> - 2005-07-14 15:38:59
|
Hi all, In the course of adding the GatewayQuiz module to the HEAD branch in the CVS, I've found that when I look at StudentProgress all student scores are being reported as zero (regardless of how many correct problems they have in the set). I think what's happening is that when we get NULL values out of the database they are promoted to empty strings, but when we put an empty string back into an integer field in the database that gets stored as zero. In particular, when a set is assigned to a student the appropriate entries in the problem_user table are created. For those the value field is set to NULL. When we get() the problems out of the table (with $db->{problem_user}->get()), the NULL is promoted to "", so that $userProblem->value() is then the empty string. As the user problem is processed by Problem.pm (or GatewayQuiz.pm), $userProblem->value() isn't changed. Then, when we put the problem back into the database after grading (with $db->{problem_user}->put()), we're putting an empty string into the integer value field, which is stored as zero. When we then get the merged problem out again, $db->getMergedProblem() checks for empty fields to decide whether to use the global problem's value. However the entry in problem_user now has value == 0, so the global problem's value (== 1) isn't used. This means that when StudentProgress.pm (et al.) calculate the student's score (by taking $userProblem->status() * $userProblem->value()), the score is zero. Does that sound right? If so, the work-around/solution may be to make $db->{}->put() demote empty strings to NULL. Comments? Thanks, Gavin -- P. Gavin LaRose, Ph.D. Program Manager (Instructional Tech.) Math Dept., University of Michigan gl...@um... "There's no use in trying," [Alice] 734.764.6454 said. "One Can't believe impossible http://www.math.lsa.umich.edu/~glarose/ things." "I daresay you haven't had much practice," said the Queen. - Lewis Carrol |