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

Return question blocked status in mod_quiz_get_attempt_data

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.2
    • Component/s: Quiz
    • Testing Instructions:
      Hide
      1. Create a course with a student.
      2. Create a quiz using "Immediate feedback" as "Question behaviour" and all the questions in same page (Layout).
      3. Add at least 2 questions to the quiz (don't use "Description" type questions).
      4. In the "Edit quiz" page, block at least 1 question, You can do it by clicking the lock icon at the right of the question.
      5. As the student, create a new attempt in the quiz. Don't answer any question. Please remember the attemptid, you'll need it later.
      6. Enable "Mobile services": Plugins ► Web Services ► Mobile
      7. Create a Token for the student:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      8. Next, you can do a CURL REST call simulating a WS client with the student user.
        • You need to replace the wstoken, attemptid and the URL of your moodle instance.

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'attemptid=1&page=0&wsfunction=mod_quiz_get_attempt_data&wstoken=5b6154a56566a194f60f7f395f235179'

          Note, you can use jsonlint.com to validate and format the json returned string or append "| python -m json.tool" to automatically format the command output.

      9. Confirm that the questions have a "blockedbyprevious" field. Confirm that blocked questions have it set to true, while non-blocked ones have it set to false.
      Show
      Create a course with a student. Create a quiz using " Immediate feedback " as " Question behaviour " and all the questions in same page ( Layout ). Add at least 2 questions to the quiz (don't use " Description " type questions). In the " Edit quiz " page, block at least 1 question, You can do it by clicking the lock icon at the right of the question. As the student, create a new attempt in the quiz. Don't answer any question. Please remember the attemptid , you'll need it later. Enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the student: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the student user. You need to replace the wstoken, attemptid and the URL of your moodle instance. curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'attemptid=1&page=0&wsfunction=mod_quiz_get_attempt_data&wstoken=5b6154a56566a194f60f7f395f235179' Note, you can use jsonlint.com to validate and format the json returned string or append "| python -m json.tool" to automatically format the command output. Confirm that the questions have a " blockedbyprevious " field. Confirm that blocked questions have it set to true, while non-blocked ones have it set to false.
    • Affected Branches:
      MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-54862-master

      Description

      Right now we have to use a "hack" to detect if a question is blocked (via parsing the html looking for a class), we should return via WS if the question is blocked via the attempt class is_blocked_by_previous_question method.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  5/Dec/16