Merge branch 'MDL-84072-405' of https://github.com/paulholden/moodle into MOODLE_405_STABLE

This commit is contained in:
Sara Arjona 2025-01-14 14:44:20 +01:00
commit 9850eeb84a
No known key found for this signature in database
3 changed files with 10 additions and 4 deletions

View File

@ -4765,7 +4765,13 @@ EOD;
*/
public function render_progress_bar_update(string $id, float $percent, string $msg, string $estimate,
bool $error = false): string {
return html_writer::script(js_writer::function_call('updateProgressBar', [$id, $percent, $msg, $estimate, $error]));
return html_writer::script(js_writer::function_call('updateProgressBar', [
$id,
round($percent, 1),
$msg,
$estimate,
$error,
]));
}
/**

View File

@ -181,7 +181,7 @@ class progress_bar implements renderable, templatable {
$this->lastupdate = microtime(true);
if ($this->autoupdate) {
echo $OUTPUT->render_progress_bar_update($this->idnumber, sprintf("%.1f", $this->percent), $msg, $estimatemsg);
echo $OUTPUT->render_progress_bar_update($this->idnumber, $this->percent, $msg, $estimatemsg);
flush();
}
}
@ -307,7 +307,7 @@ class progress_bar implements renderable, templatable {
$this->message = $errormsg;
if ($this->autoupdate) {
echo $OUTPUT->render_progress_bar_update($this->idnumber, sprintf("%.1f", $this->percent), $errormsg, '', true);
echo $OUTPUT->render_progress_bar_update($this->idnumber, $this->percent, $errormsg, '', true);
flush();
}
}

View File

@ -299,7 +299,7 @@ class stored_progress_bar extends progress_bar {
// If we want the screen to auto update, render it.
if ($this->autoupdate) {
echo $OUTPUT->render_progress_bar_update(
$this->idnumber, sprintf("%.1f", $this->percent), $this->message, $this->get_estimate_message($this->percent)
$this->idnumber, $this->percent, $this->message, $this->get_estimate_message($this->percent)
);
}
}