Closed (fixed)
Project:
Quiz
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
13 Oct 2006 at 21:16 UTC
Updated:
9 Nov 2006 at 06:01 UTC
Changing the number of questions after someone has completed the quiz, changes the score on the results page. Example: If a student complete a quiz and gets 3 out of four questions right, he or she will get a 75%. If the quiz author removes two questions, the result page changes to a score of 150% (3 correct out of 2). There is currently a "score" column in the results database table, so it makes sense to save the score at the time of completion.
My question is in regards to the format of the score. It seems like percentage is the most obvious way to save this information, especially seeing how the x out of y system is subject to change over time.
Comments
Comment #1
seanbfuller commentedAnother option would be to serialize an array holding the following information:
This would allow a better representation of the score and might also allow other modules (gradebook) to use a system other than percentages, such as points.
Comment #2
webchickSerialization is somewhere around the 9th level of Hell. ;) But we can do that if required.
Does it make more sense to alter the db schema for this, though? Serialized data should only be used as kind of a last resort for abstraction purposes. I can't envision a reason one would not want to store this information per result.
Comment #3
gilcot commentedi agree with webchick : try to avoid serialization when possible. :)
now, the only values you want to save are : $question_count, $num_correct, $percentage_score.
but $percent_score can be easly computed (parenthesis are not need): ( ( 100 * $num_correct ) / $question_count )
so one can only store : $question_count, $num_correct
right. why not do it then ? (but the 'score' field will become a varchar, and the values must always be stored in the same order (i prefer when they are sorted, i.e. $num_correct $question_count ;)) and separed by a specifique non-numeric character (i like space, coma and slash). well, as they are always only intergers, one may use dot as separator and store the result as a float (or a double ?) this later perverse solution may be funny if php know how to extact de fractional and the decimal part of a numer (but many algorithms are available at http://fr.php.net/manual/en/ref.math.php lol)
Comment #4
seanbfuller commentedAfter looking at this a bit more, I've come to similar conclusions. I've been thinking that really we just need to double check the method used to get the # of quesitons possible from the list of results instead of the current number of questions on the quiz.
Comment #5
seanbfuller commentedI went back an looked at this again and it seems that with the new code changes from the last few patches, the issue has gone away. I'm pretty sure it happened as a side-effect of the patch to implement the theme. The number of possible questions is now calculated from the answers found for that result set (rid). If someone can confirm this, that'd be great. In the meantime, I'll keep an eye on this.
Comment #6
seanbfuller commentedI'm going to go ahead and mark this fixed as the problem does in fact seem to be gone.
Comment #7
(not verified) commented