Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
namespace quiz_statistics\event\observer;
18
 
19
use core\check\performance\debugging;
20
use quiz_statistics\task\recalculate;
21
 
22
/**
23
 * Event observer for \mod_quiz\event\attempt_submitted
24
 *
25
 * @package   quiz_statistics
26
 * @copyright 2023 onwards Catalyst IT EU {@link https://catalyst-eu.net}
27
 * @author    Mark Johnson <mark.johnson@catalyst-eu.net>
28
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
29
 * @deprecated Since Moodle 4.4 MDL-80099.
30
 * @todo Final deprecation in Moodle 4.8 MDL-80956.
31
 */
32
class attempt_submitted {
33
    /**
34
     * Queue an ad-hoc task to recalculate statistics for the quiz.
35
     *
36
     * This will defer running the task for 1 hour, to give other attempts in progress
37
     * a chance to submit.
38
     *
39
     * @param \mod_quiz\event\attempt_submitted $event
40
     * @return void
41
     * @deprecated Since Moodle 4.4 MDL-80099
42
     */
43
    public static function process(\mod_quiz\event\attempt_submitted $event): void {
44
        debugging('quiz_statistics\event\observer\attempt_submitted event observer has been deprecated in favour of ' .
45
            'the quiz_statistics\hook_callbacks::quiz_attempt_submitted_or_deleted hook callback.', DEBUG_DEVELOPER);
46
        $data = $event->get_data();
47
        recalculate::queue_future_run($data['other']['quizid']);
48
    }
49
}