mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00

- Split model::predict in parts - JS promises updated according to eslint-plugin-promise - New API methods replacing direct DB queries - Reduce insights nav link display cost - Increase time limit as well as memory for big processes - Move prediction action event to core - Dataset write locking and others - Refine last time range end time - Removed dodgy splitting method id to int - Replace admin_setting_predictor output_html overwrite for write_setting overwrite - New APIs for access control - Discard invalid samples also during prediction
64 lines
2.4 KiB
PHP
64 lines
2.4 KiB
PHP
<?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/>.
|
|
|
|
/**
|
|
* 4 quarters time splitting method.
|
|
*
|
|
* @package core_analytics
|
|
* @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
*/
|
|
|
|
namespace core_analytics\local\time_splitting;
|
|
|
|
defined('MOODLE_INTERNAL') || die();
|
|
|
|
/**
|
|
* 4 quarters time splitting method.
|
|
*
|
|
* @package core_analytics
|
|
* @copyright 2016 David Monllao {@link http://www.davidmonllao.com}
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
*/
|
|
class quarters extends base {
|
|
|
|
public function get_name() {
|
|
return get_string('timesplitting:quarters', 'analytics');
|
|
}
|
|
|
|
protected function define_ranges() {
|
|
$duration = floor(($this->analysable->get_end() - $this->analysable->get_start()) / 4);
|
|
return [
|
|
[
|
|
'start' => $this->analysable->get_start(),
|
|
'end' => $this->analysable->get_start() + $duration,
|
|
'time' => $this->analysable->get_start() + $duration
|
|
], [
|
|
'start' => $this->analysable->get_start() + $duration,
|
|
'end' => $this->analysable->get_start() + ($duration * 2),
|
|
'time' => $this->analysable->get_start() + ($duration * 2)
|
|
], [
|
|
'start' => $this->analysable->get_start() + ($duration * 2),
|
|
'end' => $this->analysable->get_start() + ($duration * 3),
|
|
'time' => $this->analysable->get_start() + ($duration * 3)
|
|
], [
|
|
'start' => $this->analysable->get_start() + ($duration * 3),
|
|
'end' => $this->analysable->get_end(),
|
|
'time' => $this->analysable->get_end()
|
|
]
|
|
];
|
|
}
|
|
}
|