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

Adding and removing questions from the quiz can reset max grade.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.1.5, 2.2.2
    • 2.1.4, 2.2.1
    • Quiz
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • Hide

      1. As teacher/admin, create a quiz and go to the edit page (edit.php)

      2. Make sure Maximum grade: is set to something non-zero (e.g. 10.00). (Total of grades: will be 0.00 at this stage.)

      3. Add a description, and a True/false question, in that order. It should now say Maximum grade: 10.00, Total of grades: 1.00.

      4. Remove the True/false question. It should now say Maximum grade: 10.00, Total of grades: 0.00.

      5. Click the 'Preview' link in the settings navigation. You should see an appropriate error message, and the continue button should take you to the quiz view.php page.

      6. Remove the Description from the quiz. It should still say Maximum grade: 10.00, Total of grades: 0.00.

      7. Click the 'Preview' link in the settings navigation. The page should reload (because trying to start an attempt at an empty quiz redirects you to the quiz edit page).

      8. Copy the URL of the 'Preview' - it will be ... startattempt.php... and will include sesskey. Log in as student, and edit the startattempt.php URL to include the student's sesskey. Then try to go to that URL. You should get a different appropriate error message about not being able to start a quiz with no questions, and the continue button should take you to the quiz view.php page. (Note, the only way to get this error is to hack the URL like this.)

      9. Back as teacher/admin, go to edit.php again, go to the order and paging tab, and make sure you can set the Maximum grade.

      10. Now add the True/false question back to the quiz, and attempt the quiz as the student.

      11. Back as teacher, on edit.php, 'Edit quiz' tab. Try changing the Grade: for the True/false question to 0. The Maximum grade: should now be automatically set to 0.

      12. Set the grade for the True/false question back to something non-zero. Then set The Maximum grade: back to something non-zero. Go to the quiz reports and make sure the scores have been correctly updated at every stage to display the correct values. (If the maximum is 0, the correct behaviour may be to show no grades.)

      Show
      1. As teacher/admin, create a quiz and go to the edit page (edit.php) 2. Make sure Maximum grade: is set to something non-zero (e.g. 10.00). (Total of grades: will be 0.00 at this stage.) 3. Add a description, and a True/false question, in that order. It should now say Maximum grade: 10.00, Total of grades: 1.00. 4. Remove the True/false question. It should now say Maximum grade: 10.00, Total of grades: 0.00. 5. Click the 'Preview' link in the settings navigation. You should see an appropriate error message, and the continue button should take you to the quiz view.php page. 6. Remove the Description from the quiz. It should still say Maximum grade: 10.00, Total of grades: 0.00. 7. Click the 'Preview' link in the settings navigation. The page should reload (because trying to start an attempt at an empty quiz redirects you to the quiz edit page). 8. Copy the URL of the 'Preview' - it will be ... startattempt.php... and will include sesskey. Log in as student, and edit the startattempt.php URL to include the student's sesskey. Then try to go to that URL. You should get a different appropriate error message about not being able to start a quiz with no questions, and the continue button should take you to the quiz view.php page. (Note, the only way to get this error is to hack the URL like this.) 9. Back as teacher/admin, go to edit.php again, go to the order and paging tab, and make sure you can set the Maximum grade. 10. Now add the True/false question back to the quiz, and attempt the quiz as the student. 11. Back as teacher, on edit.php, 'Edit quiz' tab. Try changing the Grade: for the True/false question to 0. The Maximum grade: should now be automatically set to 0. 12. Set the grade for the True/false question back to something non-zero. Then set The Maximum grade: back to something non-zero. Go to the quiz reports and make sure the scores have been correctly updated at every stage to display the correct values. (If the maximum is 0, the correct behaviour may be to show no grades.)

      It turns out that that fix for MDL-21934, while an improvement, was not sufficient. We (at the OU) have now thought of a better logic.

      The problem is that if $quiz->sumgrades is 0 (such as when you have just removed all questions from a quiz, prior to adding some different ones) then we have to set $quiz->grade to 0, otherwise there will be a divide by zero error when a student attempts the quiz, and we try to compute their final grade.

      However, when you are editing the quiz, there are no attempts yet, and so this theoretical difficulty does not arise, and the resetting to 0 is bloody annoying.

      So, the proposed solution is:

      1. In quiz_update_sumgrades, change the logic for doing quiz_set_grade(0, $quiz) from layout not empty to quiz has attempts.

      2. Add a test when someone tries to start an attempt. If sumgrades is 0, while grade is non-zero, give a nice error at this time.

      3. In addition, display quiz grade on the order and paging tab of mod/quiz/edit.php, so it is clearer what is going on.

            timhunt Tim Hunt
            timhunt Tim Hunt
            Mahmoud Kassaei Mahmoud Kassaei
            Sam Hemelryk Sam Hemelryk
            Rossiani Wijaya Rossiani Wijaya
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.