Skip to content

Month-long data in a year-long report. Current time of day period separation instead of midnight. #26

Description

@OT-AndreyUskov

Hello.

it's me again.
I've found another couple of problems in the report.

in file /report/overviewstats/classes/chart.php:459
in method prepare_data_chart_enrollments($course)
in $params for $reader->get_events_select
there is a parameter:
'timestart' => $now - 30 * DAYSECS,
where
$now = time();

  1. The main problem is that the report shows a graph for the last year, but only uses data for the last 30 days.
  2. Another problem is that the data the report displays depends on what time of day the report is run. The report should take into account current user's timezone (preferable) or server's timezone and split data in midnight because when the report shows a value for a day the user expects it to represent data from midnight to midnight. And users will not understand why the values for past periods change depending on the time they view the report.

You can use Moodle Time API for the purpose of getting user's midnight time and timezones.
4.1 LTS - https://moodledev.io/docs/4.1/apis/subsystems/time
4.5 - https://moodledev.io/docs/4.5/apis/subsystems/time

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions