Making WordPress.org

Changeset 14536


Ignore:
Timestamp:
09/24/2025 08:12:35 PM (3 months ago)
Author:
coffee2code
Message:

Photo Directory, Rejection: Don't calculate a rejection rate in dashboard widget when there haven't been any rejections (for clean-slate installations).

File:
1 edited

Legend:

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

    r14103 r14536  
    13781378
    13791379        foreach ( $rejection_reasons as $reason => $data ) {
    1380             $data['count'] = $rejection_reasons_counts[ $reason ];
     1380            $data['count'] = $rejection_reasons_counts[ $reason ] ?? 0;
     1381            $rejection_pct = $total_rejections
     1382                ? round( ( $data['count'] / $total_rejections ) * 100, 2 )
     1383                : 0;
    13811384
    13821385            echo '<tr>';
    13831386            echo '<td title="' . esc_attr( $data['label'] ) . '">' . esc_html( $reason ) . '</td>';
    13841387            echo '<td>' . number_format_i18n( $data['count'] ) . '</td>';
    1385             echo '<td>' . round( ( $data['count'] / $total_rejections ) * 100, 2 ) . '%</td>';
     1388            echo '<td>' . $rejection_pct . '%</td>';
    13861389            echo "</tr>\n";
    13871390        }
Note: See TracChangeset for help on using the changeset viewer.