Skip to content

Commit

Permalink
Merge pull request #3 from varunsridharan/patch-2
Browse files Browse the repository at this point in the history
[Fixed] Division by zero | class-batch.php on line 189
  • Loading branch information
gdarko authored Jul 2, 2019
2 parents 8be23a4 + 4537df9 commit 9fac2ea
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 9fac2ea

Please sign in to comment.