Skip to content

Commit 1358e89

Browse files
committed
update: refine average issues per post logic
1 parent 3e6a9d9 commit 1358e89

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

admin/class-scans-stats.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,8 @@ function ( $item ) {
284284
$data['posts_without_issues'] = $wpdb->get_var( $posts_without_issues ) + $wpdb->get_var( $posts_with_just_ignored_issues );
285285
$data['avg_issues_per_post'] = round( ( $data['warnings'] + $data['errors'] ) / $data['posts_scanned'], 2 );
286286

287-
// If there are no issues at all, show 0. If there are issues but average is less than 1, show "< 1".
288-
if ( 0 === $data['warnings'] && 0 === $data['errors'] ) {
289-
$data['avg_issues_per_post'] = 0;
290-
} elseif ( $data['avg_issues_per_post'] < 1 && 0 !== $data['avg_issues_per_post'] ) {
287+
// Show "< 1" only when there are issues but the average is less than 1 (excluding exactly 0).
288+
if ( $data['avg_issues_per_post'] < 1 && $data['avg_issues_per_post'] > 0 ) {
291289
$data['avg_issues_per_post'] = '< 1';
292290
}
293291
}

0 commit comments

Comments
 (0)