From e8bc3294ec98e6b701c881d97bb4cb2398c3932d Mon Sep 17 00:00:00 2001 From: tfrommen Date: Fri, 13 Oct 2017 08:21:59 +0200 Subject: [PATCH] Limit step percentage to, well, 100%. :) --- inc/class-job.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/class-job.php b/inc/class-job.php index dc0fd544..5f56c4dc 100644 --- a/inc/class-job.php +++ b/inc/class-job.php @@ -933,7 +933,7 @@ public function update_working_data( $must = false ) { //calc sub step percent if ( $this->substeps_todo > 0 && $this->substeps_done > 0 ) { - $this->substep_percent = round( $this->substeps_done / $this->substeps_todo * 100 ); + $this->substep_percent = min( round( $this->substeps_done / $this->substeps_todo * 100 ), 100 ); } else { $this->substep_percent = 1; } @@ -1475,7 +1475,7 @@ public function run() { } //calc step percent if ( count( $this->steps_done ) > 0 ) { - $this->step_percent = round( count( $this->steps_done ) / count( $this->steps_todo ) * 100 ); + $this->step_percent = min( round( count( $this->steps_done ) / count( $this->steps_todo ) * 100 ), 100 ); } else { $this->step_percent = 1; }