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

TypeError in progress_bar->_update() when OS locale's decimal separator is comma

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 4.2.6, 4.3.3
    • 4.1.9, 4.2.6, 4.3.3
    • General
    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE
    • MOODLE_402_STABLE, MOODLE_403_STABLE
    • MDL-80768-402
    • MDL-80768-403
    • Hide
      1. Download 80768.patch and apply the patch locally:

        $ git apply <DIR>/80768.patch
        

      2. Log in as admin
      3. Create 3 new users
      4. Create a course
      5. Enrol all 3 users as students on course
      6. Add a quiz activity to the course
        • Add a single question (True/false is easiest to set up)
      7. Log out
      8. Log in as all 3 users and attempt quiz with each
      9. Log in as admin
      10. Navigate to quiz activity
      11. Press Results
      12. Press Regrade all
      13. Confirm there is no exception
      14. Confirm the progress bar progresses from 0% to 33.3% to 66.7% to 100% and completes
      Show
      Download 80768.patch and apply the patch locally: $ git apply <DIR>/80768.patch Log in as admin Create 3 new users Create a course Enrol all 3 users as students on course Add a quiz activity to the course Add a single question (True/false is easiest to set up) Log out Log in as all 3 users and attempt quiz with each Log in as admin Navigate to quiz activity Press Results Press Regrade all Confirm there is no exception Confirm the progress bar progresses from 0% to 33.3% to 66.7% to 100% and completes

      If the locale for sprintf() uses comma for the decimal separator then the following error occurs when regrading quiz attempts:

      Exception - core_renderer::render_progress_bar_update(): Argument #2 ($percent) must be of type float, string given, called in [dirroot]/lib/outputcomponents.php on line 5241
      (the following lines depends on the process)

      • line 5142 of /lib/outputrenderers.php: TypeError thrown
      • line 5241 of /lib/outputcomponents.php: call to core_renderer->render_progress_bar_update()
      • line 5277 of /lib/outputcomponents.php: call to progress_bar->_update()
      • line 5289 of /lib/outputcomponents.php: call to progress_bar->update_full()
      • line 592 of /mod/quiz/report/overview/report.php: call to progress_bar->update()
      • line 500 of /mod/quiz/report/overview/report.php: call to quiz_overview_report->regrade_batch_of_attempts()
      • line 274 of /mod/quiz/report/overview/report.php: call to quiz_overview_report->regrade_attempts()
      • line 112 of /mod/quiz/report/overview/report.php: call to quiz_overview_report->process_actions()
      • line 83 of /mod/quiz/report.php: call to quiz_overview_report->display()

      I cannot reproduce this as I don't have a server set up with a suitable locale (such as pt_BR) but presumably this happens if:

      1. Your server's system locale uses a comma as the decimal separator.
      2. Set up a course with a quiz and add a question to the quiz.
      3. Enrol a student on the course.
      4. As the student attempt the quiz.
      5. As an admin view the quiz attempts, select the above attempt and click Regrade selected attempts.

        1. 80768.patch
          1 kB
        2. MDL-80768.png
          MDL-80768.png
          179 kB

            pholden Paul Holden
            leonstr Leon Stringer
            Stevani Andolo Stevani Andolo
            Andrew Lyons Andrew Lyons
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            6 Vote for this issue
            Watchers:
            7 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, 41 minutes
                2h 41m

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