Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-56303

Critical lack of quiz filtering in quiz upgrade

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.0.7, 3.1.2, 3.2
    • Fix Version/s: 3.0.7, 3.1.3
    • Component/s: Quiz
    • Labels:

      Description

      Reported by colin:

      The mod/quiz/db/upgrade.php entry for this ticket appears to be updating a lot more than just quiz course modules. Neither the SELECT nor the UPDATE are specific enough to include only quizzes.

          if ($oldversion < 2015111602) {
              // Find quizzes with the combination of require passing grade and grade to pass 0.
              $quizzes = $DB->get_records_sql("
                  SELECT gi.id, gi.iteminstance
                    FROM {quiz} q
              INNER JOIN {course_modules} cm ON q.id = cm.instance
              INNER JOIN {grade_items} gi ON q.id = gi.iteminstance
                   WHERE q.completionpass = 1
                     AND gi.gradepass = 0
                     AND cm.completiongradeitemnumber IS NULL");
              if ($quizzes) {
                  foreach ($quizzes as $quiz) {
                      $DB->execute("UPDATE {course_modules}
                                       SET completiongradeitemnumber = :gradeitemid
                                     WHERE instance = :quizid",
                          array('gradeitemid' => $quiz->id, 'quizid' => $quiz->iteminstance));
                  }   
              }   
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  2 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    14/Nov/16