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

Return quiz pass grade via web services

XMLWordPrintable

    • MOODLE_311_STABLE
    • MOODLE_311_STABLE
    • MDL-71492-master
    • 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

      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.

       

            jleyva Juan Leyva
            jleyva Juan Leyva
            Carlos Escobedo Carlos Escobedo
            Jake Dallimore Jake Dallimore
            Gladys Basiana Gladys Basiana
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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