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

mod_quiz_get_attempt_review returns a translated errorcode if attempt cannot be reviewed

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.6.3
    • Fix Version/s: 3.6.5, 3.7.1
    • Component/s: Quiz
    • Labels:
    • Testing Instructions:
      Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Create a new quiz in a course with just a question (or use an existing one). In "Review options", disable all the options except the ones in "Immediately after the attempt".
      3. As student, start and finish an attempt.
      4. Wait 2 minutes.
      5. Create a Token in the mobile app service for the student user
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours and the attempid with the id of the attempt (you can retrieve it from the Moodle database or get the id from the link from the Moodle web interface link "Review attempt")

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_quiz_view_attempt_review&wstoken=3af67232a7596ceb658df4db329e5ad6&attemptid=12' | python -m "json.tool"

      7. Check that among the returned data you see an "errorcode": "noreview",
      8. Confirm that you see "You are not allowed to review this quiz" in "message" and "debuginfo" (if debugging is enabled).
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a new quiz in a course with just a question (or use an existing one). In "Review options", disable all the options except the ones in "Immediately after the attempt". As student, start and finish an attempt. Wait 2 minutes. Create a Token in the mobile app service for the student user Click on Site administration ► Plugins ► Web services ► Manage tokens Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours and the attempid with the id of the attempt (you can retrieve it from the Moodle database or get the id from the link from the Moodle web interface link "Review attempt") curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_quiz_view_attempt_review&wstoken=3af67232a7596ceb658df4db329e5ad6&attemptid=12' | python -m "json.tool" Check that among the returned data you see an "errorcode": "noreview", Confirm that you see "You are not allowed to review this quiz" in "message" and "debuginfo" (if debugging is enabled).
    • Affected Branches:
      MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE, MOODLE_37_STABLE
    • Pull from Repository:
    • Pull 3.6 Branch:
    • Pull 3.7 Branch:
    • Pull Master Branch:
      MDL-65274-master

      Description

      How to reproduce:

      1. Create a new quiz. In "Review options", disable all the options except the ones in "Immediately after the attempt".
      2. Add at least 1 question in the quiz.
      3. As student, start and finish an attempt.
      4. Wait 2 minutes.
      5. Perform a WS call to mod_quiz_get_attempt_review with the attempt you just finished. Check that the errorcode you receive is a translated string: "You are not allowed to review this quiz".

      In the app we want to treat this specific error, but we can't because it's not a proper errorcode.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  8/Jul/19

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 20 minutes
                  1h 20m