From 2fc838042f32d0ad16375077056107e403477825 Mon Sep 17 00:00:00 2001 From: Sergey Zakharchenko Date: Tue, 11 Apr 2023 17:43:04 +0100 Subject: [PATCH] Fixed notice and very long % in change ( +0,09999 ) --- php/classes/class-ssp-stats.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/php/classes/class-ssp-stats.php b/php/classes/class-ssp-stats.php index cf94ea7..d4abe85 100755 --- a/php/classes/class-ssp-stats.php +++ b/php/classes/class-ssp-stats.php @@ -649,9 +649,9 @@ public function stats_page () { } else { $week_diff = round( ( $listens_this_week / $listens_last_week * 100 ), 1 ); if( $week_diff < 100 ) { - $week_diff = '-' . ( 100 - $week_diff ) . '%'; + $week_diff = '-' . round(100 - $week_diff, 1) . '%'; } elseif( $week_diff > 100 ) { - $week_diff = '+' . ( $week_diff - 100 ) . '%'; + $week_diff = '+' . round( $week_diff - 100, 1 ) . '%'; } else { $week_diff = '0%'; } @@ -714,6 +714,9 @@ public function stats_page () { $li_class = 'alternate'; foreach( $results as $result ) { $episode = get_post( $result->post_id ); + if ( ! $episode ) { + continue; + } $episode_link = admin_url( 'post.php?post=' . $episode->ID . '&action=edit' ); $html .= '
  • ' . sprintf( _n( '%d %slisten%s', '%d %slistens%s', $result->listens, 'seriously-simple-stats' ), $result->listens, '', '' ) . ' ' . esc_html( $episode->post_title ) . '
  • ' . "\n"; if( '' == $li_class ) {