mirror of
https://github.com/moodle/moodle.git
synced 2025-04-19 23:42:11 +02:00
MDL-70536 cli: Fixed cli progress bar when 100% more than once
This commit is contained in:
parent
67fb670cc6
commit
a87ddbd685
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
|
@ -4939,9 +4939,6 @@ class core_renderer_cli extends core_renderer {
|
||||
$ascii .= '<cursor:up>';
|
||||
$ascii .= sprintf("[$bar] %3.1f%% %-22s\n", $percent, $estimate);
|
||||
$ascii .= sprintf("%-80s\n", $msg);
|
||||
if ($percent == 100) {
|
||||
$ascii .= "\n";
|
||||
}
|
||||
return cli_ansi_format($ascii);
|
||||
}
|
||||
|
||||
@ -4950,12 +4947,12 @@ class core_renderer_cli extends core_renderer {
|
||||
// which can only ever go forwards.
|
||||
$done = round($percent * $size * 0.01);
|
||||
$delta = max(0, $done - $this->progressmaximums[$id]);
|
||||
$this->progressmaximums[$id] += $delta;
|
||||
|
||||
$ascii .= str_repeat('#', $delta);
|
||||
if ($percent >= 100) {
|
||||
if ($percent >= 100 && $delta > 0) {
|
||||
$ascii .= sprintf("] %3.1f%%\n$msg\n", $percent);
|
||||
}
|
||||
$this->progressmaximums[$id] += $delta;
|
||||
return $ascii;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user