Non-core contributed modules

Hotpot incorrectly counts number of attempts when entering quiz

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.9.11
  • Fix Version/s: None
  • Component/s: Module: HotPot
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE

Description

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

Activity

Hide
Eric Merrill added a comment -

A diff of my change against cvs.

Show
Eric Merrill added a comment - A diff of my change against cvs.
Hide
Gordon Bateson added a comment -

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.

Show
Gordon Bateson added a comment - 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.
Hide
Gordon Bateson added a comment -

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

Show
Gordon Bateson added a comment - 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
Hide
Eric Merrill added a comment -

Works here. I think this can be resolved.

Thanks
-eric

Show
Eric Merrill added a comment - Works here. I think this can be resolved. Thanks -eric
Hide
Eric Merrill added a comment -

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

Show
Eric Merrill added a comment - 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

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: