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

Return quiz pass grade via web services

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.11
    • Fix Version/s: 3.11
    • Component/s: Quiz
    • Testing Instructions:
      Hide
      1. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      2. Create a new course
      3. Create a new quiz activity in the course setting the "Grade to pass" to for example: 5.50
      4. Create a Token in the mobile app service for one user enrolled in the course where you created the quiz as student
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      5. Open the console an execute this new curl request, replacing wstoken with the token you just created and the site url with yours. Replace also the QUIZID, with the id of the quiz you created (the instance id, not the module id)

        curl 'http://YOUR_SITE/webservice/rest/server.php?moodlewsrestformat=json' --data 'quizid=QUIZID&moodlewssettingfilter=true&moodlewssettingfileurl=true&wsfunction=mod_quiz_get_user_best_grade&wstoken=WS_TOKEN'

      6. Confirm that:
        • In the curl request response you see a "gradetopass" field set to the grade you set when creating the quiz
      7. Now, go back to the quiz settings and set the "Grade to pass" to 0.0
      8. Execute again the previous curl request and confirm that:
        • In the curl request response you don't see a "gradetopass" field at all
      Show
      As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a new course Create a new quiz activity in the course setting the "Grade to pass" to for example: 5.50 Create a Token in the mobile app service for one user enrolled in the course where you created the quiz as student 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. Replace also the QUIZID, with the id of the quiz you created (the instance id, not the module id) curl 'http://YOUR_SITE/webservice/rest/server.php?moodlewsrestformat=json' --data 'quizid=QUIZID&moodlewssettingfilter=true&moodlewssettingfileurl=true&wsfunction=mod_quiz_get_user_best_grade&wstoken=WS_TOKEN' Confirm that: In the curl request response you see a "gradetopass" field set to the grade you set when creating the quiz Now, go back to the quiz settings and set the "Grade to pass" to 0.0 Execute again the previous curl request and confirm that: In the curl request response you don't see a "gradetopass" field at all
    • Affected Branches:
      MOODLE_311_STABLE
    • Fixed Branches:
      MOODLE_311_STABLE
    • Pull from Repository:
    • Pull 3.11 Branch:
      MDL-71492-311
    • Pull Master Branch:
      MDL-71492-master

      Description

      In MDL-71181 it was decided to display the grade to pass if a quiz have it configured before a user starts a quiz.

      The problem is that this information is not returned via Web Services so it will be necessary to create a new WebService or extend an existing one so extenral clients are able to display this information as well.

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jleyva Juan Leyva
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Carlos Escobedo Carlos Escobedo
              Integrator:
              Jake Dallimore Jake Dallimore
              Tester:
              Gladys Basiana Gladys Basiana
              Participants:
              Component watchers:
              Tim Hunt, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                17/May/21

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours, 40 minutes
                  2h 40m