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

Filtering/paging grades summary report throws exceptions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 4.1
    • 4.1
    • Gradebook
    • MOODLE_401_STABLE
    • MOODLE_401_STABLE
    • Hide
      1. Log in as admin
      2. Create a course
        • Group mode: Separate groups
      3. Create a group in the course
      4. Inside course, add 3 each of the following activities:
        • Assignment
        • Quiz
      5. Edit grade/report/summary/classes/local/systemreports/summary.php to reduce the paging size, adding the following class method:

            public function get_default_per_page(): int {
                return 2;
            }
        

      6. Back on the course page, press Grades in navigation
      7. Select Grade summary
      8. Confirm you can use the paging bar to browse the report
      9. Press Filters
      10. Set Type of activity to Is equal to: Assignment
      11. Press Apply
      12. Confirm report is filtered to only assignment activities
      Show
      Log in as admin Create a course Group mode: Separate groups Create a group in the course Inside course, add 3 each of the following activities: Assignment Quiz Edit grade/report/summary/classes/local/systemreports/summary.php to reduce the paging size, adding the following class method: public function get_default_per_page(): int { return 2; } Back on the course page, press Grades in navigation Select Grade summary Confirm you can use the paging bar to browse the report Press Filters Set Type of activity to Is equal to: Assignment Press Apply Confirm report is filtered to only assignment activities

      The new "Grades summary" report recently added in MDL-75156 throws exceptions if you try to page/filter the report, when inside a course with groups

      codingerror
      Coding error detected, it must be fixed by a programmer: $PAGE->context was not set. You may have forgotten to call require_login() or $PAGE->set_context()
      File: /lib/pagelib.php
      Line: 562
      Stack trace:
       
      Error code: codingerror
      * line 562 of /lib/pagelib.php: coding_exception thrown
      * line 962 of /lib/pagelib.php: call to moodle_page->magic_get_context()
      * line 1456 of /lib/weblib.php: call to moodle_page->__get()
      * line 633 of /lib/grouplib.php: call to format_string()
      * line 649 of /lib/grouplib.php: call to groups_list_to_menu()
      * line 593 of /lib/grouplib.php: call to groups_sort_menu_options()
      * line 375 of /grade/report/lib.php: call to groups_print_course_menu()
      * line 57 of /grade/report/summary/lib.php: call to grade_report->setup_groups()
      * line 94 of /grade/report/summary/classes/local/entities/grade_items.php: call to grade_report_summary->__construct()
      * line 257 of /reportbuilder/classes/local/report/base.php: call to gradereport_summary\local\entities\grade_items->initialise()
      * line 46 of /grade/report/summary/classes/local/systemreports/summary.php: call to core_reportbuilder\local\report\base->add_entity()
      * line 99 of /reportbuilder/classes/local/report/base.php: call to gradereport_summary\local\systemreports\summary->initialise()
      * line 65 of /reportbuilder/classes/system_report.php: call to core_reportbuilder\local\report\base->__construct()
      * line 64 of /reportbuilder/classes/manager.php: call to core_reportbuilder\system_report->__construct()
      * line 48 of /reportbuilder/classes/form/filter.php: call to core_reportbuilder\manager::get_report_from_persistent()
      * line 57 of /reportbuilder/classes/form/filter.php: call to core_reportbuilder\form\filter->get_report()
      * line 68 of /lib/form/classes/dynamic_form.php: call to core_reportbuilder\form\filter->get_context_for_dynamic_submission()
      * line 73 of /lib/form/classes/external/dynamic_form.php: call to core_form\dynamic_form->__construct()
      * line 261 of /lib/externallib.php: call to core_form\external\dynamic_form::execute()
      * line 81 of /lib/ajax/service.php: call to external_api::call_external_function()
      

      The problem is that the report relies on $PAGE->context being set before initialisation

        1. MDL-75955_testing.webm
          1.87 MB
          Angelia Dela Cruz
        2. Screencast 2022-10-11 214310.gif
          195 kB
          Paul Holden

            pholden Paul Holden
            pholden Paul Holden
            Ilya Tregubov Ilya Tregubov
            Jun Pataleta Jun Pataleta
            Angelia Dela Cruz Angelia Dela Cruz
            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 - 1 hour, 46 minutes
                1h 46m

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