Skip to content

Commit

Permalink
Fixed notice and very long % in change ( +0,09999 )
Browse files Browse the repository at this point in the history
  • Loading branch information
zahardev committed Apr 11, 2023
1 parent 53479d3 commit 2fc8380
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions php/classes/class-ssp-stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -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%';
}
Expand Down Expand Up @@ -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 .= '<li class="' . esc_attr( $li_class ) . '"><span class="first-col top-ten-count">' . sprintf( _n( '%d %slisten%s', '%d %slistens%s', $result->listens, 'seriously-simple-stats' ), $result->listens, '<span>', '</span>' ) . '</span> <span class="top-ten-title"><a href="' . $episode_link . '">' . esc_html( $episode->post_title ) . '</a></span></li>' . "\n";
if( '' == $li_class ) {
Expand Down

0 comments on commit 2fc8380

Please sign in to comment.