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

Duplicate month with zero is displayed in the report stats

XMLWordPrintable

    • MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • MOODLE_23_STABLE, MOODLE_24_STABLE
    • MDL-36380-master
    • Hide

      Test pre-requisites

      • Use an instance with more than 12 months worth of stats (or generate some, or use the attached script)
      • Enable the statistics
      • Run the cron to generate the statistics (or use attached script)
      • Set timezone to Server time

      /!\ Please note that the attached script gen_stats.php will wipe your logs and statistics. Real data is much more valuable, also read through the code before executing.

      Test steps

      1. Go to Home ► Site pages ► Reports ► Statistics ► Reports ► Statistics
        • View the last 2 weeks
        • View the last 3 months
        • View the last 7 months
        • View the last 2 years
        • Make sure that there is no duplicate entry in either the graph or the table
      2. Repeat the test 3 times with a different timezone
      Show
      Test pre-requisites Use an instance with more than 12 months worth of stats (or generate some, or use the attached script) Enable the statistics Run the cron to generate the statistics (or use attached script) Set timezone to Server time /!\ Please note that the attached script gen_stats.php will wipe your logs and statistics. Real data is much more valuable, also read through the code before executing. Test steps Go to Home ► Site pages ► Reports ► Statistics ► Reports ► Statistics View the last 2 weeks View the last 3 months View the last 7 months View the last 2 years Make sure that there is no duplicate entry in either the graph or the table Repeat the test 3 times with a different timezone

      When viewing the report statistics for greater then 7 months (ie when only the first of each month is shown) almost all months are duplicated with statistics of zero.

      Images attached show the stats and the graph pre and post the patch being applied.

      I have traced the issue and it seems to be coming from the function: stats_fix_zeros()
      It occurs because the times in the parameter $stat are normalised however the newly generated times are not normalised. By normalising the new times the same way everything appears properly.

      My commit can be found here: https://github.com/mdikih/moodle/commit/d5fd7d8eb4770524e20f782f52b4ed146aa3b217

      This issue has been reported before in 2008 affecting 1.9. Since this fix is for 2.2 I have created a new ticket.
      http://tracker.moodle.org/browse/MDL-17813
      http://tracker.moodle.org/browse/MDL-19838

        1. generate_stats.php
          5 kB
        2. postPatch_graph.png
          postPatch_graph.png
          17 kB
        3. postPatch_stats.png
          postPatch_stats.png
          36 kB
        4. prePatch_graph.png
          prePatch_graph.png
          18 kB
        5. prePatch_stats.png
          prePatch_stats.png
          45 kB

            fred Frédéric Massart
            mdikih Michael Wylde
            Adam Olley Adam Olley
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Michael de Raadt Michael de Raadt
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

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