Skip to content

Commit

Permalink
MDL-69967 analytics: add upcoming 1 day time splitting method
Browse files Browse the repository at this point in the history
  • Loading branch information
danielneis committed Oct 18, 2023
1 parent 23b8625 commit 96a86cd
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lang/en/moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -2244,6 +2244,8 @@
$string['timesplitting:pastmonth_help'] = 'This analysis interval generates predictions every month. The indicators calculations will be based on the past month.';
$string['timesplitting:pastweek'] = 'Past week';
$string['timesplitting:pastweek_help'] = 'This analysis interval generates predictions every week. The indicators calculations will be based on the past week.';
$string['timesplitting:upcoming1day'] = 'Upcoming 1 day';
$string['timesplitting:upcoming1day_help'] = 'This analysis interval generates predictions every day. The indicators calculations will be based on the upcoming day.';
$string['timesplitting:upcoming3days'] = 'Upcoming 3 days';
$string['timesplitting:upcoming3days_help'] = 'This analysis interval generates predictions every 3 days. The indicators calculations will be based on the upcoming 3 days.';
$string['timesplitting:upcomingfortnight'] = 'Upcoming fortnight';
Expand Down
53 changes: 53 additions & 0 deletions lib/classes/analytics/time_splitting/upcoming_1_day.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Time splitting method that generates insights every three days and calculates indicators using upcoming dates.
*
* @package core_analytics
* @copyright 2020 Daniel Neis Araujo <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace core\analytics\time_splitting;

defined('MOODLE_INTERNAL') || die();

/**
* Time splitting method that generates insights every day and calculates indicators using upcoming dates.
*
* @package core_analytics
* @copyright 2020 Daniel Neis Araujo <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class upcoming_1_day extends \core_analytics\local\time_splitting\upcoming_periodic {

/**
* The time splitting method name.
* @return \lang_string
*/
public static function get_name() : \lang_string {
return new \lang_string('timesplitting:upcoming1day');
}

/**
* Once every day.
* @return \DateInterval
*/
public function periodicity() {
return new \DateInterval('P1D');
}
}

0 comments on commit 96a86cd

Please sign in to comment.