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

New methods to add all columns/filters/conditions at once

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.1
    • 4.1
    • Report builder
    • MOODLE_401_STABLE
    • MOODLE_401_STABLE
    • MDL-74497-master
    • Hide
      1. Log in as admin
      2. Select Reports from user menu
      3. Create a new report using the "Users" data source
      4. Confirm that all the "User" columns are shown on the left (Full name, Full name with link, etc...)
      5. Open the Conditions dropdown and confirm that all the "User" conditions can be added to the report
      6. Open the filters dropdown and confirm that all the "User" filters can be added to the report
      7. Press the "Close" button
      8. Create a new report using the "Courses" data source
      9. Confirm that all the "Course" and "Course category" columns are shown on the left (Course full name with link, etc...)
      10. Open the Conditions dropdown and confirm that all the "Course" and "Course category" conditions can be added to the report
      11. Open the filters dropdown and confirm that all the "Course" and "Course category" filters can be added to the report
      12. Press the "Close" button
      13. Create a new report using the "Cohorts" data source
      14. Confirm that all the "Cohort", "Cohort member" and "User" columns are shown on the left (Category, Name, etc...)
      15. Open the Conditions dropdown and confirm that all the "Cohort", "Cohort member" and "User" conditions can be added to the report
      16. Open the filters dropdown and confirm that all the "Cohort", "Cohort member" and "User" filters can be added to the report
      Show
      Log in as admin Select Reports from user menu Create a new report using the "Users" data source Confirm that all the "User" columns are shown on the left (Full name, Full name with link, etc...) Open the Conditions dropdown and confirm that all the "User" conditions can be added to the report Open the filters dropdown and confirm that all the "User" filters can be added to the report Press the "Close" button Create a new report using the "Courses" data source Confirm that all the "Course" and "Course category" columns are shown on the left (Course full name with link, etc...) Open the Conditions dropdown and confirm that all the "Course" and "Course category" conditions can be added to the report Open the filters dropdown and confirm that all the "Course" and "Course category" filters can be added to the report Press the "Close" button Create a new report using the "Cohorts" data source Confirm that all the "Cohort", "Cohort member" and "User" columns are shown on the left (Category, Name, etc...) Open the Conditions dropdown and confirm that all the "Cohort", "Cohort member" and "User" conditions can be added to the report Open the filters dropdown and confirm that all the "Cohort", "Cohort member" and "User" filters can be added to the report

    Description

      While converting current Workplace data sources to use the new core Report Builder we have been following this pattern quite often, sometimes even 7 times in the same data source:

      // Add course entity columns/filters/conditions.
      $this->add_columns_from_entity($courseentityname);
      $this->add_filters_from_entity($courseentityname);
      $this->add_conditions_from_entity($courseentityname);

      It would be really useful to have a couple of new methods to do this at once and keep the current data sources cleaner:

      ->add_all_from_entity(..) To add all columns/filters/conditions from one entity.

      ->add_all_from_entities() To add all columns/filters/conditions from all the entities used in the data source.

       

      The code in this example can be simplified using these new methods:

      https://github.com/moodle/moodle/blob/5423e5f4435098bed40763eccbb5931a3da063a3/cohort/classes/reportbuilder/datasource/cohorts.php#L73-L86

      Attachments

        Activity

          People

            davidmatamoros David Matamoros
            davidmatamoros David Matamoros
            Paul Holden Paul Holden
            Jun Pataleta Jun Pataleta
            Angelia Dela Cruz Angelia Dela Cruz
            Carlos Castillo, David Matamoros, Mikel Martín Corrales, Paul Holden
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              28/Nov/22

              Time Tracking

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