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

Return question blocked status in mod_quiz_get_attempt_data

XMLWordPrintable

    • MOODLE_31_STABLE
    • MOODLE_32_STABLE
    • MDL-54862-master
    • 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.

      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.

            dpalou Dani Palou
            jleyva Juan Leyva
            Mark Nelson Mark Nelson
            Dan Poltawski Dan Poltawski
            Simey Lameze Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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