mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
MDL-78327 question stats: store same timestamp for all question stats
This commit is contained in:
parent
4ed782dd03
commit
ddd1ce66fd
@ -276,11 +276,11 @@ class all_calculated_for_qubaid_condition {
|
||||
$timemodified = time();
|
||||
|
||||
foreach ($this->get_all_slots() as $slot) {
|
||||
$this->for_slot($slot)->cache($qubaids);
|
||||
$this->for_slot($slot)->cache($qubaids, $timemodified);
|
||||
}
|
||||
|
||||
foreach ($this->get_all_subq_ids() as $subqid) {
|
||||
$this->for_subq($subqid)->cache($qubaids);
|
||||
$this->for_subq($subqid)->cache($qubaids, $timemodified);
|
||||
}
|
||||
|
||||
$transaction->allow_commit();
|
||||
|
@ -219,12 +219,13 @@ class calculated {
|
||||
* Cache calculated stats stored in this object in 'question_statistics' table.
|
||||
*
|
||||
* @param \qubaid_condition $qubaids
|
||||
* @param int|null $timemodified the modified time to store. Defaults to the current time.
|
||||
*/
|
||||
public function cache($qubaids) {
|
||||
public function cache($qubaids, $timemodified = null) {
|
||||
global $DB;
|
||||
$toinsert = new \stdClass();
|
||||
$toinsert->hashcode = $qubaids->get_hash_code();
|
||||
$toinsert->timemodified = time();
|
||||
$toinsert->timemodified = $timemodified ?? time();
|
||||
foreach ($this->fieldsindb as $field) {
|
||||
$toinsert->{$field} = $this->{$field};
|
||||
}
|
||||
@ -232,7 +233,7 @@ class calculated {
|
||||
|
||||
if ($this->get_variants()) {
|
||||
foreach ($this->variantstats as $variantstat) {
|
||||
$variantstat->cache($qubaids);
|
||||
$variantstat->cache($qubaids, $timemodified);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user