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

Overrides not taken into account in WebService mod_quiz_get_combined_review_options

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 4.2.6, 4.3.3
    • 4.4
    • Quiz
    • MOODLE_404_STABLE
    • MOODLE_402_STABLE, MOODLE_403_STABLE
    • MDL-80718-403
    • MDL-80718-master
    • Hide
      1. As an admin, enable “Web services for mobile devices” on Site administration ► Advanced features
      2. Create a course and a user, and enrol the user as a student in the course.
      3. In the course, create a new quiz with the following settings:
        1. Review options: uncheck "Marks" and "Maximum marks" inside "During the attempt", "Immediately after the attempt" and "Later, while the quiz is still open", but keep them checked in "After the quiz is closed". So you need to have 3 unchecked checkboxes and 1 checked for "Marks" and for "Maximum marks". 
      4. Add at least 1 question in the quiz.
      5. As the student, attempt the quiz and finish the attempt.
      6. Back as admin, edit the quiz settings and change "Timing > Close the quiz": enable this option and set it to a date in the past (quiz is closed).
      7. Create a Token in the mobile app service for the student on the site (not an admin account)
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      8. Open the console and execute this new curl request, replacing WS_TOKEN with the token you just created and the SITE_URL with yours and QUIZ_ID with the id of the quiz (the instance id, not the course module ID).

        curl ‘SITE_URL/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_quiz_get_combined_review_options&quizid=QUIZ_ID&wstoken=WS_TOKEN' | python -m "json.tool"

      1. Confirm that the returned data contains an option with name="marks" and value=2.
      2. As admin, go to the quiz and click More > Overrides.
      3. Click "Add user override".
      4. In "Override user" select the student, and in "Close the quiz" change the date and put a date in the future. Save changes.
      5. Repeat the CURL request again. Check that now the "marks" option has value=0.
      Show
      As an admin, enable “Web services for mobile devices” on Site administration ► Advanced features Create a course and a user, and enrol the user as a student in the course. In the course, create a new quiz with the following settings: Review options: uncheck "Marks" and "Maximum marks" inside "During the attempt", "Immediately after the attempt" and "Later, while the quiz is still open", but keep them checked in "After the quiz is closed". So you need to have 3 unchecked checkboxes and 1 checked for "Marks" and for "Maximum marks".  Add at least 1 question in the quiz. As the student, attempt the quiz and finish the attempt. Back as admin, edit the quiz settings and change "Timing > Close the quiz": enable this option and set it to a date in the past (quiz is closed). Create a Token in the mobile app service for the student on the site (not an admin account) Click on Site administration ► Plugins ► Web services ► Manage tokens Open the console and execute this new curl request, replacing WS_TOKEN with the token you just created and the SITE_URL with yours and QUIZ_ID with the id of the quiz (the instance id, not the course module ID). curl ‘SITE_URL/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_quiz_get_combined_review_options&quizid=QUIZ_ID&wstoken=WS_TOKEN' | python -m "json.tool" Confirm that the returned data contains an option with name="marks" and value=2. As admin, go to the quiz and click More > Overrides. Click "Add user override". In "Override user" select the student, and in "Close the quiz" change the date and put a date in the future. Save changes. Repeat the CURL request again. Check that now the "marks" option has value=0.

      The WebService mod_quiz_get_combined_review_options doesn't take overrides into account, so the options returned can be wrong.

        1. MDL-80718.png
          65 kB
          Ron Carl Alfon Yu

            dpalou Dani Palou
            dpalou Dani Palou
            Juan Leyva Juan Leyva
            Tim Hunt Tim Hunt
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 hours
                5h

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