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

Null values not preserved in report column callbacks during aggregation

XMLWordPrintable

    • MOODLE_400_STABLE
    • MOODLE_400_STABLE
    • Hide

      Master

      1. No need to test. Already covered by automated tests

      4.0

      1. Download MDL-74656-400.diff patch (to add a LEFT JOIN on the course entity to a report) to your moodle root instance.
      2. Apply the patch

        git apply  MDL-74656-400.diff
        

      3. Log in as admin
      4. Navigate to Reports in user menu
      5. Create new report from Users report source, with default setup
      6. Add Course > Course full name with link column
      7. Set Course full name with link column aggregation to Comma separated values
      8. Confirm aggregation is applied without exceptions
      Show
      Master No need to test. Already covered by automated tests 4.0 Download MDL-74656-400.diff patch (to add a LEFT JOIN on the course entity to a report) to your moodle root instance. Apply the patch git apply MDL-74656-400.diff Log in as admin Navigate to Reports in user menu Create new report from Users report source, with default setup Add Course > Course full name with link column Set Course full name with link  column aggregation to Comma separated values Confirm aggregation is applied without exceptions

      It seems that when coursefullnamewithlink, courseshortnamewithlink and courseidnumberewithlink aggregation is applied, shows the error msg:

      Invalid context level specified

      The problem is that when the column is aggregated, and is LEFT JOIN'ed to the report/another entity any subsequent NULL values are not preserved when passing data to the column callbacks

      What actually gets passed is ' ' (string containing single space character) because of https://github.com/moodle/moodle/blob/941a29925e5cd1c1dddefa08cede7950593080b0/reportbuilder/classes/local/aggregation/base.php#L102-L103. For cross-DB support we can't pass an empty string in the COALESCE(...) call (Oracle), so instead we should let the caller define

      Edit the problem can be replicated in LMS using the Badges report source, I've added a testcase for this in second commit on master branch (master only because this report source doesn't exist in 4.0)

        1. Aggregation error.jpg
          Aggregation error.jpg
          105 kB
        2. MDL-74656__v400.png
          MDL-74656__v400.png
          81 kB
        3. MDL-74656-400.diff
          1 kB

            pholden Paul Holden
            carlos.castillo@moodle.com Carlos Castillo
            Carlos Castillo Carlos Castillo
            Jun Pataleta Jun Pataleta
            John Edward Pedregosa John Edward Pedregosa
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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