Ho Rajesh, Tim and co,
sorry but there is something here that I don't like at all. I've tried importing the "GIFT-examples" file in 1.9, 2.0 and master. And this is what I've got:
- 19_STABLE: scores are imported as 0/1. For example, the first question in the file, with 3 answers get 1 score point with the 3rd "no one" and 0 with the rest.
- 20_STABLE: Although the import is not working at all (the answers are lost), scores are imported and they seem to work like 19_STABLE, aka 0/1.
- master: scores are imported as 0/100.
So, at some point, not sure when/why, the scores, that ALWAYS (1.9, 2.0 and master) have been multiplied * 100, started producing 0-100 scores versus 0-1 ones. I bet it is something in Tim's "artillery" or perhaps some annoying integer casting at some point, but I don't know really the cause for that (nor Tim's explanation above clarified that to me).
I must say that, surely (in my mind) it shouldn't affect final grade calculation, but my mind isn't a good (safe) place. So the logical approach should be:
1) Modify master to continue setting scores in the 0-1 range. Surely that implies to take out all those * 100.
2) Backport the fix to 20_STABLE (but take into account that probably you'll need the x100 there). Right now it's 100% (not 1%, LOL) broken.
But that 1) has an important drawback that is that scores will be ONLY 0 or 1 as far as the score column in DB is one integer, so it does not accept decimals. See for example how the question "Jesus' hometown::Jesus Christ was from" is imported. Now in 2.1 we are getting correct 0, 25, 75 and 100, but in 1.9 it only returns 0, 0, 0, and 1.
So, the most I think on this, the most I believe that such a "* 100" was done on purpose exactly for that (to get 0-100 scores). And for some reason it never worked ok in 1.9 and 2.0 and started working ok in 2.1. So that lead me to propose:
1) Accept current patch and start setting 0-100 scores.
2) Backport the fix to 20_STABLE (but take into account that probably you'll need the x100 there to get the 0-1 values, who knows).
But finally, I've been looking how grades are calculated by lesson - lesson_grade() - and it seems that scores are only taken into account if the lesson has been created to use "custom scores", else +1 is used. So, once again, I'm lost, should we be importing the questions in a different way depending of that setting? Also, when scores are used (custom scores = yes), they are all summed globally so, indeed, deciding about to import them like 0-1 or 0-100 is going to have a BIG impact.
So, to decide:
APPROACH A: Old one but "rounds" all fractions to 0. Safer because of BC.
APPROACH B: New one and more "exact", respecting fractions. Horrible (risky) if mixed with old 0-1 questions.
Really I'm not sold to any of them, specially 2 days before release. Surely I'd go to the APPROACH B so people can start importing those questions better. If that messes their lessons, well, they'll need to adjust the scores. Surely this requires to be documented somewhere.
So reopen and decide, my +0.8 goes to approach B, break old-wrong behavior and import the questions in a richer way.