Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-3409

Hotpot incorrectly counts number of attempts when entering quiz

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: 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

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: