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

Quiz Web Services should return attached files during attempts

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.10
    • Component/s: Quiz
    • Labels:
    • Testing Instructions:
      Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
        # Create a new course and enrol a user (u1) as student
      2. Create a new quiz in the course using the default configuration except: Layout -> New page -> Every 3 questions
      3. Add 3 questions to the quiz:
        • 1: Essay configured to use "HTML Editor" as response format, "Allow attachments" set to NO
        • 2: Essay configured to use "No online text" as response format, "Allow attachments" set to 1 and "require attachments" to 1
        • 3: Essay configured to use "HTML Editor with file picker" as response format, "Allow attachments" set to 2
      4. Access with the student user u1 to the site, go to the course and open the quiz
      5. Add some text in the first question, attach a file in the second question and in the last question attach two files and in the html editor textarea add some text and one image
      6. Click "Finish attempt" and nothing else, you will see the summary of the attempt
      7. In the browser URL you will see an URL like this: mod/quiz/summary.php?attempt=X&cmid=Y. You have to copy the X value somewhere because you will use it later
      8. Create a Token in the mobile app service for the user1 in the site (not an admin account)
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      9. Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. the ATTEMPT_ID value has to be replaced with the attempt value (the X value) you annotated before

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

      10. Confirm that:
        • In the curl request response (that is huge) you will see that 3 questions are returned
        • For the first question, the "responsefileareas" field is empty
        • For the second question, the responsefileareas field has the file you attached for the second question
        • For the third question, the responsefileareas has three files. The two attached and the image included in the editor
      11. If you copy the different URLs of the files in the same browser where the u1 is logged in, you will see/download the files
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings # Create a new course and enrol a user (u1) as student Create a new quiz in the course using the default configuration except: Layout -> New page -> Every 3 questions Add 3 questions to the quiz: 1: Essay configured to use "HTML Editor" as response format, "Allow attachments" set to NO 2: Essay configured to use "No online text" as response format, "Allow attachments" set to 1 and "require attachments" to 1 3: Essay configured to use "HTML Editor with file picker" as response format, "Allow attachments" set to 2 Access with the student user u1 to the site, go to the course and open the quiz Add some text in the first question, attach a file in the second question and in the last question attach two files and in the html editor textarea add some text and one image Click "Finish attempt" and nothing else, you will see the summary of the attempt In the browser URL you will see an URL like this: mod/quiz/summary.php?attempt=X&cmid=Y. You have to copy the X value somewhere because you will use it later Create a Token in the mobile app service for the user1 in the site (not an admin account) 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. the ATTEMPT_ID value has to be replaced with the attempt value (the X value) you annotated before curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=mod_quiz_get_attempt_summary&wstoken=3af67232a7596ceb658df4db329e5ad6&attemptid=ATTEMPT_ID' | python -m "json.tool" Confirm that: In the curl request response (that is huge) you will see that 3 questions are returned For the first question, the "responsefileareas" field is empty For the second question, the responsefileareas field has the file you attached for the second question For the third question, the responsefileareas has three files. The two attached and the image included in the editor If you copy the different URLs of the files in the same browser where the u1 is logged in, you will see/download the files
    • Affected Branches:
      MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_310_STABLE
    • Pull from Repository:
    • Pull 3.10 Branch:
      MDL-54956-310
    • Pull Master Branch:
      MDL-54956-master

      Description

      Right now, the attached files (file areas) for the quiz, questions and question usages are not alwaysreturned.

      • mod_quiz_get_attempt_data: attachments for the current attempt responses (this issue)
      • mod_quiz_get_question_data: generic question filearea, qtype file area (MDL-69766)
      • mod_quiz_get_quizzes_by_courses: Is not returned the intro and feedback file areas (done in MDL-55728)
      • get_quiz_feedback_for_grade: feedback area files (done in MDL-55728)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jleyva Juan Leyva
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Tim Hunt
              Integrator:
              Adrian Greeve
              Tester:
              Janelle Barcega
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Nov/20

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 30 minutes
                  1d 30m