Skip to content

Commit 88829c0

Browse files
committed
Only calculate progress when we need to.
1 parent 688b5cf commit 88829c0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

wpengine-phpcompat.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ function check_status() {
122122
'status' => $scan_status,
123123
'count' => $count_jobs->publish,
124124
'total' => $total_jobs,
125-
'progress' => 100 - ( ( $count_jobs->publish / $total_jobs ) * 100 ),
126125
'activeJob' => $active_job,
127126
'version' => $test_version,
128127
'onlyActive' => $only_active,
@@ -131,6 +130,8 @@ function check_status() {
131130
// If the scan is still running.
132131
if ( $scan_status ) {
133132
$to_encode['results'] = '0';
133+
// Adding one because we don't remove an item until it's done processing.
134+
$to_encode['progress'] = 100 - ( ( ( $count_jobs->publish + 1 ) / $total_jobs ) * 100 );
134135
} else {
135136
// Else return the results and clean up!
136137
$scan_results = get_option( 'wpephpcompat.scan_results' );

0 commit comments

Comments
 (0)