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

Quiz test_process_attempt test sends debugging output if an essay question is present in the attempt and that question includes attaachments

XMLWordPrintable

    • MOODLE_311_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE
    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MDL-75914-401
    • MDL-75914-master
    • Hide

      Apply the path and follow the instructions below:

      1. Log in as admin
      2. Create a course
      3. Enrol a student
      4. Create a quiz (default options)
      5. Add an essay question in the quiz (default options)
      6. Enable web services for mobile devices from Site admin -> Advanced features
      7. Navigate to Site admin -> Server -> Web services -> Manage tokens
      8. Create a token for the student.
      9. Log in as the student
      10. Make sure the student use Atto HTML Editor by navigate to User Preferences -> Editor Preferences -> Text Editor: Atto HTML Editor. Save changes.
      11. Attempt the quiz, but do not finish the attempt. Make a note of the attempt number in the URL.
      12. Open your favorite terminal, open 2 tabs:
        • Tail your web server error log. e.g.:

          tail /var/log/php7.4-fpm.log -f

          Note: Replace the log file location with the one on your machine.


        • Curl the mod_quiz_get_attempt_data webservice:

          curl --location --request POST 'http://localhost/stable_master/webservice/rest/server.php?moodlewsrestformat=json' \
          --header 'Content-Type: application/x-www-form-urlencoded' \
          --data-urlencode 'attemptid=4' \
          --data-urlencode 'page=0' \
          --data-urlencode 'wsfunction=mod_quiz_get_attempt_data' \
          --data-urlencode 'wstoken=ad6c49470c3f7bba448161aaef1496c4'

          Note: Replace the hostname, attemptid, and wstoken from the data you have collected.


      13. Observe debugging notice in the error log. Verify that you are not seeing below warning/notice:

        [19-Dec-2022 12:32:57] WARNING: [pool www] child 28637 said into stderr: "NOTICE: PHP message: Debugging: This page did not call $PAGE->set_url(...). Using http://localhost/stable_master/webservice/rest/server.php?moodlewsrestformat=json in "
        [19-Dec-2022 12:32:57] WARNING: [pool www] child 28637 said into stderr: "* line 674 of /lib/pagelib.php: call to debugging()" ...
        .....

      Show
      Apply the path and follow the instructions below: Log in as admin Create a course Enrol a student Create a quiz (default options) Add an essay question in the quiz (default options) Enable web services for mobile devices from Site admin -> Advanced features Navigate to Site admin -> Server -> Web services -> Manage tokens Create a token for the student. Log in as the student Make sure the student use Atto HTML Editor by navigate to User Preferences -> Editor Preferences -> Text Editor: Atto HTML Editor. Save changes. Attempt the quiz, but do not finish the attempt. Make a note of the attempt number in the URL. Open your favorite terminal, open 2 tabs: Tail your web server error log. e.g.: tail /var/log/php7. 4 -fpm.log -f Note: Replace the log file location with the one on your machine. Curl the mod_quiz_get_attempt_data webservice: curl --location --request POST 'http://localhost/stable_master/webservice/rest/server.php?moodlewsrestformat=json' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'attemptid=4' \ --data-urlencode 'page=0' \ --data-urlencode 'wsfunction=mod_quiz_get_attempt_data' \ --data-urlencode 'wstoken=ad6c49470c3f7bba448161aaef1496c4' Note: Replace the hostname, attemptid, and wstoken from the data you have collected. Observe debugging notice in the error log. Verify that you are not seeing below warning/notice: [ 19 -Dec- 2022 12 : 32 : 57 ] WARNING: [pool www] child 28637 said into stderr: "NOTICE: PHP message: Debugging: This page did not call $PAGE->set_url(...). Using http://localhost/stable_master/webservice/rest/server.php?moodlewsrestformat=json in " [ 19 -Dec- 2022 12 : 32 : 57 ] WARNING: [pool www] child 28637 said into stderr: "* line 674 of /lib/pagelib.php: call to debugging()" ... .....
    • 6
    • Team Hedgehog Sprint 1.3

      Steps to reproduce:

      1. Create a quiz (default options)
      2. Create an essay question in that quiz:
        1. Set the "Allow attachments" option to 3
      3. Attempt the quiz as a student - save, but do not finish the attempt.
      4. Make a note of the attempt number in the URL
      5. Log in as admin
      6. Enable mobile web services from Site admin -> Advanced features
      7. Navigate to Site admin -> Server -> Web services -> Manage tokens
      8. Create a token for that user
      9. Tail your web server error log
      10. Curl the mod_quiz_get_attempt_data ws:

        curl --location --request POST 'http://mandarin.local/sm/webservice/rest/server.php?moodlewsrestformat=json' \
        --header 'Content-Type: application/x-www-form-urlencoded' \
        --data-urlencode 'attemptid=4' \
        --data-urlencode 'page=0' \
        --data-urlencode 'wsfunction=mod_quiz_get_attempt_data' \
        --data-urlencode 'wstoken=c2609ab77a4a51e01aeb129fb57a92da'
        

        Note: You will need to replace the hostname, attemptid, and wstoken from the data you have collected

        1. Observe debugging notice

      [Fri Oct 07 12:37:57.037742 2022] [php7:notice] [pid 14508] [client 127.0.0.1:58538] This page did not call $PAGE->set_url(...). Using http://mandarin.local/sm/webservice/rest/server.php?moodlewsrestformat=json
      [Fri Oct 07 12:37:57.037811 2022] [php7:notice] [pid 14508] [client 127.0.0.1:58538] Debugging: This page did not call $PAGE->set_url(...). Using http://mandarin.local/sm/webservice/rest/server.php?moodlewsrestformat=json in \n* line 676 of /lib/pagelib.php: call to debugging()\n* line 964 of /lib/pagelib.php: call to moodle_page->magic_get_url()\n* line 189 of /lib/editor/atto/lib.php: call to moodle_page->__get()\n* line 159 of /lib/editor/atto/lib.php: call to atto_texteditor->get_init_params()\n* line 321 of /question/type/essay/renderer.php: call to atto_texteditor->use_editor()\n* line 53 of /question/type/essay/renderer.php: call to qtype_essay_format_editor_renderer->response_area_input()\n* line 378 of /question/engine/renderer.php: call to qtype_essay_renderer->formulation_and_controls()\n* line 102 of /question/engine/renderer.php: call to core_question_renderer->formulation()\n* line 113 of /question/behaviour/behaviourbase.php: call to core_question_renderer->question()\n* line 907 of /question/engine/questionattempt.php: call to question_behaviour->render()\n* line 461 of /question/engine/questionusage.php: call to question_attempt->render()\n* line 1779 of /mod/quiz/attemptlib.php: call to question_usage_by_activity->render_question()\n* line 1740 of /mod/quiz/attemptlib.php: call to quiz_attempt->render_question_helper()\n* line 989 of /mod/quiz/classes/external.php: call to quiz_attempt->render_question()\n* line 1076 of /mod/quiz/classes/external.php: call to mod_quiz_external::get_attempt_questions_data()\n* line 1516 of /webservice/lib.php: call to mod_quiz_external::get_attempt_data()\n* line 1362 of /webservice/lib.php: call to webservice_base_server->execute()\n* line 44 of /webservice/rest/server.php: call to webservice_base_server->run()\n
      

      If the editor for a user is Atto, then the editor makes use of the Page URL, taken from $PAGE->url as part of the data to ensure that autosave works correctly.

      When called from a web service, the PAGE->url is not set, hence the error.

      This is currently eaten in its unit test (grr).

      We need to fix this because if we change the default editor to not be Atto, then we no longer have debugging, and mod_quiz\external\external_test::test_process_attempt will fail because of the lack of debugging.

      It is not clear whether we should:

      • fix this just for this web service
      • address this in the web service layer, by setting up a $PAGE object a bit more.

        1. (I) 13 Passed -- (400)MDL-75914.png
          328 kB
          Kim Jared Lucas
        2. (I) 13 Passed -- (401)MDL-75914.png
          328 kB
          Kim Jared Lucas
        3. (I) 13 Passed -- (Master)MDL-75914.png
          325 kB
          Kim Jared Lucas

            meirza.arson@moodle.com Meirza
            dobedobedoh Andrew Lyons
            Tim Hunt Tim Hunt
            Paul Holden Paul Holden
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            1 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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