Issue Details (XML | Word | Printable)

Key: MDL-13328
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Gordon Bateson
Reporter: Eric Merrill
Votes: 0
Watchers: 1
Operations

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

Hotpot incorrectly counts number of attempts when entering quiz

Created: 04/Feb/08 11:55 PM   Updated: 07/Feb/08 10:37 PM
Return to search
Component/s: Hotpot
Affects Version/s: 1.9
Fix Version/s: 1.6.7, 1.7.5, 1.8.5, 1.9

File Attachments: 1. File view.diff (0.5 kB)


Participants: Eric Merrill and Gordon Bateson
Security Level: None
Resolved date: 07/Feb/08
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE


 Description  « Hide
When you enter (as a student) the hotpot quiz to take it, it counts all records in prefix_hotpot_attempts and compares that number against the allowed attempt count. If it is more then the allowed count then it won't let you in.

The problem is that prefix_hotpot_attempts can record multiple entries for one attempt (it appears to be one per page view).

In mod/hotpot/index.php the attempt count is gained by selecting COUNT(DISTINCT clickreportid).

So on line 64 of mod/hotpot/view.php, I changed the line from:
} else if ($hotpot->attempts && $hotpot->attempts <= count_records('hotpot_attempts', 'hotpot', $hotpot->id, 'userid', $USER->id)) {
to:
} else if ($hotpot->attempts && $hotpot->attempts <= count_records_select('hotpot_attempts', 'hotpot='.$hotpot->id.' AND userid='.$USER->id, 'COUNT(DISTINCT clickreportid)')) {

This basically changes it so that attempts are counted the same way in both places.

Questions, comments?

-eric



 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Eric Merrill added a comment - 05/Feb/08 12:00 AM
A diff of my change against cvs.

Gordon Bateson added a comment - 07/Feb/08 01:13 PM
Thanks very much for highlighting this issue and supplying the fix.

I have added the fix to Moodle 1.9, and will make similar changes to Moodle 1.6 - 1.8 and 2.0 in due course.


Gordon Bateson added a comment - 07/Feb/08 01:22 PM
I have added the fix to Moodle 1.6 -> 2.0. When you have the chance, please confirm it works for you.

many thanks
Gordon


Eric Merrill added a comment - 07/Feb/08 10:35 PM
Works here. I think this can be resolved.

Thanks
-eric


Eric Merrill added a comment - 07/Feb/08 10:37 PM
Im not exactly sure who/how to give this to QA, or if they automatically review resolved tickets and close them. So give this to someone if that needs to be done. Otherwise I've resolved it.

-eric