Skip to content

Commit

Permalink
[Fixed] Division by zero | class-batch.php on line 189
Browse files Browse the repository at this point in the history
Warning:  Division by zero in E:\localhost\www\wp\framework\wponion\wp-content\plugins\wp-batch-processing-master\includes\class-batch.php on line 189
  • Loading branch information
varunsridharan authored Jul 2, 2019
1 parent 8be23a4 commit 4537df9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions includes/class-batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function get_items_count() {
public function get_percentage() {
$total_items = $this->get_items_count();
$total_processed = $this->get_processed_count();
$percentage = 100 - ( ( ( $total_items - $total_processed ) / $total_items ) * 100 );
$percentage = ( ! empty( $total_items ) ) ? 100 - ( ( ( $total_items - $total_processed ) / $total_items ) * 100 ) : 0;

return number_format( (float) $percentage, 2, '.', '' );
}
Expand All @@ -206,4 +206,4 @@ public function restart() {
delete_option( $this->get_db_identifier() );
}

}
}

0 comments on commit 4537df9

Please sign in to comment.