Making WordPress.org

Changeset 14441


Ignore:
Timestamp:
04/29/2025 04:23:40 PM (7 months ago)
Author:
coffee2code
Message:

Photo Directory, Admin: Don't calculate a rejection rate when contributor only has submission errors as rejections.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/admin.php

    r14426 r14441  
    11751175
    11761176        $author = get_user_by( 'id', $post->post_author );
    1177         $photos_count = User::count_published_photos( $author->ID );
     1177        $published_count = User::count_published_photos( $author->ID );
    11781178        $account_created = explode( ' ', $author->user_registered )[0];
    11791179        ?>
     
    12071207                        printf(
    12081208                            __( 'Published photos: <strong>%s</strong>', 'wporg-photos' ),
    1209                             ( 0 === $photos_count )
    1210                                 ? $photos_count
    1211                                 : sprintf( '<a href="%s">%s</a>', get_author_posts_url( $author->ID ), $photos_count )
     1209                            ( 0 === $published_count )
     1210                                ? $published_count
     1211                                : sprintf( '<a href="%s">%s</a>', esc_url( get_author_posts_url( $author->ID ) ), $published_count )
    12121212                        );
    12131213                    ?></li>
     
    13071307
    13081308                    echo '<p>';
    1309                     /* translators: %s: Rejection rate as a percentage. */
    1310                     printf( __( 'Total rejection rate: %s', 'wporg-photos'), '<strong>' . round( ( $total_rejections / ( $photos_count + $total_rejections ) ) * 100, 2 ) .'%</strong>' );
     1309                    $total_count = $published_count + $total_rejections;
     1310                    $rejection_rate = $total_count
     1311                        ? round( ( $total_rejections / $total_count ) * 100, 2 )
     1312                        : 0;
     1313
     1314                    printf(
     1315                        /* translators: %s: Rejection rate as a percentage. */
     1316                        __( 'Total rejection rate: %s', 'wporg-photos'),
     1317                        '<strong>' . $rejection_rate .'%</strong>'
     1318                    );
    13111319                    echo "</p>\n";
    13121320
Note: See TracChangeset for help on using the changeset viewer.