From a87ddbd685ed2d4ed0dc492262c2cf2eba7ce73a Mon Sep 17 00:00:00 2001 From: Brendan Heywood Date: Sat, 6 Feb 2021 15:50:02 +1100 Subject: [PATCH] MDL-70536 cli: Fixed cli progress bar when 100% more than once --- admin/cli/dashboard_reset.php | 1 - lib/outputrenderers.php | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/admin/cli/dashboard_reset.php b/admin/cli/dashboard_reset.php index bbe858742d5..6b6f7e3d608 100644 --- a/admin/cli/dashboard_reset.php +++ b/admin/cli/dashboard_reset.php @@ -1,5 +1,4 @@ '; $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; }