Issue Details (XML | Word | Printable)

Key: MDL-1647
Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: Tim Hunt
Reporter: Imported
Votes: 16
Watchers: 15
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Allowing negative marks for questions

Created: 15/Jul/04 01:31 AM   Updated: 04/Nov/09 10:01 PM
Return to search
Component/s: Quiz
Affects Version/s: 1.4.5
Fix Version/s: None

File Attachments: 1. Text File moodle-1.6.4plus-MDL1647-Allowing_negative_marks_for_questions.patch (4 kB)
2. Text File moodle-1.6.4plus-MDL1647-Allowing_negative_marks_for_questions_v2.patch (3 kB)
3. Text File moodle-1.8.4plus-MDL1647-Allowing_negative_marks_for_questions.patch (3 kB)
4. Text File moodle-1.8.6plus-MDL1647-Allowing_negative_marks_for_questions.patch (3 kB)

Environment: All
Issue Links:
Duplicate
 
Relates
 

Participants: Imported, Jitendra Patel, Martin Dougiamas, Paulo Matos and Tim Hunt
Security Level: None
Affected Branches: MOODLE_14_STABLE


 Description  « Hide
I needed a way to simulate Advanced Placement multiple choice tests in which incorrect answers deduct .25% from the total score of the test.



I made two very minor changes to mod/quiz/lib.php to do this, and it seems to work.



I only tested it on multiple choice (with both one and multiple answers), and Cloze questions (pull-down style only). For my purposes, I made the correct answer be 100%, and all incorrect choices be -25%. This with the changes in lib.php seem to work.



This thread describes my changes, and Martin asked that I report it as a bug.

http://moodle.org/mod/forum/discuss.php?d=9704

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Martin Dougiamas added a comment - 11/Jul/06 08:04 PM
From Gustav Delius (gwd2 at york.ac.uk) Thursday, 30 December 2004, 07:08 PM:

Hi Jill,

if you still haven't observed any negative side effects of this hack then I would like to put it into Moodle 1.5.

Gustav

From Gustav Delius (gwd2 at york.ac.uk) Saturday, 7 May 2005, 01:39 AM:

Ah, I almost forgot about this. Our new code again rules out negative marks for questions. I am not sure why, it just seemed natural to us. I will see if I find the time to fix that, it shouldn't be too difficult. I am upgrading the priority on this.

From Gustav Delius (gwd2 at york.ac.uk) Thursday, 23 February 2006, 05:49 PM:

This subject has come up again on the forums, see for example http://moodle.org/mod/forum/discuss.php?d=40310&parent=185678

From Gustav Delius (gwd2 at york.ac.uk) Thursday, 23 February 2006, 05:51 PM:

Also see http://moodle.org/mod/forum/discuss.php?d=40128.

We could implement another quiz option to allow negative marks for questions.

From John Isner (john.isner at gmail.com) Tuesday, 11 July 2006, 08:04 PM:

Standardized tests such as the SAT deduct 1/4 point for each wrong answer to a MCQ. It is very difficult to simulate those tests in moodle without this feature.


Michael Blake made changes - 21/Aug/06 05:05 PM
Field Original Value New Value
Reporter anonymous [ anonymous ]
Tim Hunt made changes - 23/Aug/06 07:42 PM
Status In Progress [ 3 ] Open [ 1 ]
Paulo Matos added a comment - 01/Mar/07 07:46 PM
This patch allows multichoice and multianswer questiontypes to have negative marks. I choose this two types because it seemd to me the most logical ones. The total sum of all questions on a quiz is set to zero if negative.

Paulo Matos made changes - 01/Mar/07 07:46 PM
Tim Hunt added a comment - 01/Mar/07 08:20 PM
Some feedback on the patch:

The reason this bug is non-trivial is that you have to consider what happens in adaptive mode as well as non-adaptive mode. Your patch does not consider that.

Also, "//paulo.matos: ..." comments are not helpful. CVS tracks who changed what, so names in comments just clutter the code. So only use comments to describe what the code is doing, like "// Make sure sumgrades are non-negative."

Comments like "// This should not be here, ..." do not inspire confidence (questionlib line ~1060). In fact, this comment confused me. It was clearer to me what was going on when I ignored the comment and worked out what the code is doing.

I think that any patch that fixes this should treat all question types the same. This is a pain becuase the


Tim Hunt added a comment - 01/Mar/07 08:24 PM
(Dratted thing. I had not finished. Why did it suddenly submit my comment when I hit return, to continue ...)

I think that any patch that fixes this should treat all question types the same. This is a pain because the

$state->raw_grade = min(max((float) $state->raw_grade, 0.0), 1.0)

  • $question->maxgrade;

line of code is copied and pasted into each question type. Probably we need to start by making a method in the base class that applies this logic, and then call that function from each question type. Then we can fix this bug in one place.

So, a good attempt to fix this bug, but it needs more work before it can be committed to core.

Also, I feel that this counts as a new feature, so I would be reluctant to add it to the 1.6 stable branch. I would rather put in into HEAD. By all means you can make a patch available to people who want to patch their own 1.6 installs, but for core, we need a patch against HEAD.

Thanks for your help.


Paulo Matos added a comment - 01/Mar/07 10:02 PM
> Also, "//paulo.matos: ..." comments are not helpful.
Sorry for that I'll clean that on my next patches. I use it to track my changes while working on the patch.

> Comments like "// This should not be here, ..." do not inspire confidence (questionlib line ~1060). In fact, this comment confused me. It was clearer to me what was going on when I ignored the comment and worked out what the code is doing.

Ok, I might not expressed quite well on that comment! This comment was about the block code, that is runned every time, even if does not have penalties or timelimit constraints. It should be like a note to the merger. I'll post a new version of the patch with it more clear (hopefully).


Paulo Matos added a comment - 01/Mar/07 10:29 PM
Ok, here's the new version of the patch.

The comments on the previous one were doubts about the block:
// Ensure that the grade does not go down
$state->grade = max($state->grade, $state->last_graded->grade);

I concluded that this block is specific to penalties/timelimit/closing time, and coded accordingly.

Cheers,

Paulo


Paulo Matos made changes - 01/Mar/07 10:29 PM
Paulo Matos added a comment - 22/Mar/07 02:34 AM
Tim> I think that any patch that fixes this should treat all question types the same.
I choosed multichoice and multianswer questiontypes to have negative marks because their were the single one's where you can set a negative mark for an answer through the UI.

Paulo Matos made changes - 22/Mar/07 02:51 AM
Link This issue is duplicated by MDL-5324 [ MDL-5324 ]
Tim Hunt made changes - 02/Nov/07 04:29 AM
Link This issue has been marked as being related by MDL-6364 [ MDL-6364 ]
Tim Hunt made changes - 02/Nov/07 04:32 AM
Link This issue is duplicated by MDL-5863 [ MDL-5863 ]
Paulo Matos added a comment - 06/May/08 09:13 PM
Here goes the updated patch for 1.8.x, only multichoice and multianswer questions are treated because those are the only ones that allow setting a negative value through UI.

Paulo Matos made changes - 06/May/08 09:13 PM
Paulo Matos added a comment - 01/Oct/08 07:05 PM
1.8.6+ version

Paulo Matos made changes - 01/Oct/08 07:05 PM
Jitendra Patel added a comment - 01/Dec/08 04:52 AM
I am also facing the Problem but i dont know how to install patch in my site

if anybody can help me


Tim Hunt made changes - 11/Dec/08 07:58 PM
Link This issue is duplicated by MDL-17605 [ MDL-17605 ]
Tim Hunt made changes - 25/Jan/09 05:47 PM
Link This issue is duplicated by MDL-18013 [ MDL-18013 ]
Tim Hunt added a comment - 25/Jan/09 05:51 PM
Note: a proper solution to this issue is part of this proposal: http://docs.moodle.org/en/Development:Changing_the_Moodle_Question_Engine (There is currently no schedule for implementing it.)

Dan Poltawski made changes - 23/Mar/09 09:06 PM
Link This issue is duplicated by MDL-4535 [ MDL-4535 ]
Tim Hunt made changes - 04/Nov/09 10:01 PM
Link This issue is duplicated by MDL-20726 [ MDL-20726 ]