Making WordPress.org

Changeset 13009


Ignore:
Timestamp:
12/05/2023 02:18:57 AM (10 months ago)
Author:
dd32
Message:

Plugin Directory: Stats: Reviewer stats take two.

See #6994.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/tools/class-stats-report.php

    r13000 r13009  
    267267            CASE
    268268                WHEN `comment_content` LIKE concat( 'Assigned to%', comment_author, '%' ) THEN 'Assigned to self.'
    269                 WHEN `comment_content` LIKE 'Assigned to%' THEN 'Assigned to other.'
     269                WHEN `comment_content` LIKE 'Assigned to%' THEN 'Assigned to others.'
    270270                ELSE `comment_content`
    271271            END AS `_thing`,
     
    277277                AND `comment_agent` = ''
    278278                AND (
    279                     `comment_content` IN( 'Plugin Approved.', 'Plugin Rejected.' )
     279                    `comment_content` IN( 'Plugin Approved.', 'Plugin Rejected.', 'Unassigned.' )
    280280                    OR `comment_content` LIKE 'Assigned TO%'
    281281                    OR (
     
    622622
    623623        <h3>Reviewer Stats</h3>
    624         <p><em>NOTE: These are not intended on being made public. Data displayed for the <?php echo esc_html( $user_stats['num_days'] ); ?> ending <?php echo esc_html( $user_stats['date'] ); ?></em></p>
    625 
    626         <?php
    627             $data_points = [
    628                 'Assigned to self.',
    629                 'Assigned to other.',
    630                 'Plugin approved.',
    631                 'Plugin rejected.',
    632                 'Plugin closed',
    633                 'Emails^',
    634             ];
    635             $close_types = [];
    636 
    637             // Determine the close reasons in this timeframe.
    638             foreach ( $user_stats['data'] as $user => $user_stat ) {
    639                 foreach ( preg_grep( '/^Plugin closed\./', array_keys( $user_stat ) ) as $reason ) {
    640                     $close_types[ trim( explode( ':', $reason )[1] ) ] = true;
    641                 }
    642             }
    643             $close_types = array_keys( $close_types );
    644 
    645             ?>
    646             <table class="widefat">
     624        <p><em>NOTE: These are not intended on being made public. Data displayed for the <?php echo esc_html( $user_stats['num_days'] ); ?> days ending <?php echo esc_html( $user_stats['date'] ); ?></em></p>
     625
     626        <table class="widefat review-stats">
    647627            <thead>
    648628                <tr>
    649                     <th rowspan="2">Reviewer</th>
    650                     <th rowspan="2" style="text-align:center">Assigned<br/>(to others)</th>
    651                     <th colspan="2" style="text-align:center">Plugins</th>
    652                     <th colspan="<?php echo esc_attr( count( $close_types ) ); ?>" style="text-align:center">Plugins closed</th>
    653                     <th colspan="2" style="text-align:center">Emails^</th>
     629                    <th>Reviewer</th>
     630                    <th>Assigned<br>(to others)</th>
     631                    <th>Plugins<br>Approved</th>
     632                    <th>Plugins<br>Rejected</th>
     633                    <th>Plugins<br>Closed</th>
     634                    <th>Email<br>Actions^</th>
     635                    <th>Email<br>Replies^</th>
    654636                </tr>
    655                 <tr>
    656                     <th>Approved</th>
    657                     <th>Rejected</th>
    658                     <?php foreach ( $close_types as $type ) : ?>
    659                         <th><?php echo esc_html( Template::get_close_reasons()[ $type ] ); ?></th>
    660                     <?php endforeach; ?>
    661                     <th>Actions</th>
    662                     <th>Replies</th>
    663                 </tr>
    664 
    665637            </thead>
    666638            <?php
     
    671643                echo '<tr><th>', esc_html( $user->display_name ?: $user->user_login ), '</th>';
    672644
    673                 // Assigned.
    674                 echo '<td>', number_format_i18n( $user_stat[ 'Assigned to self.' ] ?? 0 );
     645                // Assigned, Unassigned, Assigned to others.
     646                echo '<td><span title="Assigned to self">', number_format_i18n( $user_stat[ 'Assigned to self.' ] ?? 0 ), '</span>';
     647                if ( $user_stat[ 'Unassigned.' ] ?? 0 ) {
     648                    echo '<span title="Unassigned"> -', number_format_i18n( $user_stat[ 'Unassigned.' ] ), '</span>';
     649                }
    675650                if ( $user_stat[ 'Assigned to others.' ] ?? 0 ) {
    676                     echo ' (', number_format_i18n( $user_stat[ 'Assigned to others.' ] ), ')';
     651                    echo ' <span title="Assigned to others">(', number_format_i18n( $user_stat[ 'Assigned to others.' ] ), ')</span>';
    677652                }
    678653                echo '</td>';
     
    683658
    684659                // Plugins Closed.
    685                 foreach ( $close_types as $close_type ) {
    686                     echo '<td>', number_format_i18n( $user_stat[ "Plugin closed. Reason: {$close_type}" ] ?? 0 ), '</td>';
     660                $user_closed_breakdown = '';
     661                $user_closed_count     = 0;
     662                foreach ( $user_stat as $key => $count ) {
     663                    if ( ! preg_match( '/^Plugin closed\./', $key ) ) {
     664                        continue;
     665                    }
     666                    $reason             = trim( explode( ':', $key )[1] );
     667                    $user_closed_count += $count;
     668
     669                    $user_closed_breakdown .= sprintf(
     670                        "%s: %s\n",
     671                        Template::get_close_reasons()[ $reason ],
     672                        number_format_i18n( $count )
     673                    );
    687674                }
     675                $user_closed_breakdown = trim( $user_closed_breakdown );
     676
     677                echo '<td class="breakdown">', '<span title="', esc_attr( $user_closed_breakdown ), '">', number_format_i18n( $user_closed_count ), '</span>';
     678                if ( $user_closed_breakdown ) {
     679                    echo '<div class="hidden">', nl2br( $user_closed_breakdown ), '</div>';
     680                }
     681                echo '</td>';
    688682
    689683                // Emails.
     
    695689            echo '</table>';
    696690
     691            echo '<script> jQuery(document).ready( function($) {
     692                $("table.review-stats").on( "click", ".breakdown", function() {
     693                    $(this).children().length > 1 && $(this).children().toggleClass("hidden");
     694                } );
     695            } );</script>'
     696
    697697            ?>
    698698            <ul style="font-style:italic;">
    699699                <li><code>^</code> : This is currently of all Helpscout mailboxes, not Plugins specific. Requires your Helpscout email to be the same as your WordPress.org email, or as one of your profiles alternate emails.</li>
    700                 <li>Email "Actions" include sending emails, replying to emails, marking as spam, moving to different inbox, etc.</li>
     700                <li><code>^</code> : Email "Actions" include sending emails, replying to emails, marking as spam, moving to different inbox, etc.</li>
    701701            </ul>
    702702
Note: See TracChangeset for help on using the changeset viewer.