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

Critical lack of quiz filtering in quiz upgrade

    XMLWordPrintable

    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:
    • Testing Instructions:
      Hide

      BEFORE last weeks weekly ( a few weeks ago)

      1. Create a couple of quizzes with:
        1. Grade to pass: 0.00
        2. Completion tracking: Show activity as complete when conditions are met
        3. Select Require passing grade.
      2. Add a few multiple choice or true/false questions to the quiz.

      UPGRADE:

      1. Take the quiz made there as a student, answering all questions correctly.
      2. Return to the course home.
      3. The quiz should be marked as completed
      Show
      BEFORE last weeks weekly ( a few weeks ago) Create a couple of quizzes with: Grade to pass: 0.00 Completion tracking: Show activity as complete when conditions are met Select Require passing grade. Add a few multiple choice or true/false questions to the quiz. UPGRADE: Take the quiz made there as a student, answering all questions correctly. Return to the course home. The quiz should be marked as completed
    • Affected Branches:
      MOODLE_30_STABLE, MOODLE_31_STABLE, MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE, MOODLE_31_STABLE
    • Pull Master Branch:
      MDL-56303-master

      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));
                  }   
              }   
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                poltawski Dan Poltawski
                Reporter:
                poltawski Dan Poltawski
                Integrator:
                Eloy Lafuente (stronk7)
                Tester:
                Eloy Lafuente (stronk7)
                Participants:
                Component watchers:
                Tim Hunt, Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze
              • Votes:
                2 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

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