Making WordPress.org

Changeset 11364


Ignore:
Timestamp:
12/13/2021 08:34:37 AM (3 years ago)
Author:
dd32
Message:

SVN Watcher: Fix some bugs in the reports.

See #5978.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin/reports-page.php

    r11362 r11364  
    182182            case 'versions-contributed':
    183183                    $details = $wpdb->get_results(
    184                         "SELECT prop_name, user_id, COUNT(*) as count, group_concat( version ORDER BY version ASC  SEPARATOR ', ' ) as versions FROM (
     184                        "SELECT prop_name, user_id, COUNT( distinct version ) as count,
     185                            group_concat( distinct version ORDER BY version ASC  SEPARATOR ', ' ) as versions,
     186                            ifnull(user_id,prop_name) as _groupby
     187                        FROM (
    185188                            SELECT distinct LEFT(version, 3) as version, prop_name, p.user_id
    186189                            FROM {$details['props_table']} p
    187190                                JOIN {$details['rev_table']} r ON p.revision = r.id
    188                             group by prop_name, version
     191                            GROUP BY prop_name, version
     192                            UNION
     193                            SELECT distinct LEFT(version, 3) as version, r.author as prop_name, u.ID as user_id
     194                            FROM {$details['rev_table']} r
     195                                JOIN {$wpdb->users} u ON r.author = u.user_login
     196                            GROUP BY r.author, version
    189197                        ) a
    190                         group by prop_name HAVING COUNT(*) > 2
    191                         ORDER BY COUNT(*) DESC"
     198                        WHERE version != ''
     199                        group by _groupby HAVING COUNT(*) > 1
     200                        ORDER BY `count` DESC"
    192201                    );
    193202
     
    210219
    211220                        printf(
    212                             '<tr><td>%s</td><td>%s</td><td>%s</td></tr>',
     221                            '<tr><td>%s</td><td>%s</td><td title="%s">%s</td></tr>',
    213222                            $profile,
    214223                            $p->count,
     224                            esc_attr( $p->versions ),
    215225                            $p->versions
    216226                        );
    217227                    }
    218228                    echo '</table>';
     229
     230                    break;
    219231            case 'typos':
    220232                $details = $wpdb->get_results(
     
    258270            case 'raw-contributors-and-committers':
    259271                $details = $wpdb->get_results(
    260                     "SELECT p.prop_name, u.user_nicename, u.display_name, u.ID,
    261                     IFNULL(p.user_id,p.prop_name) as _groupby
     272                    "SELECT prop_name, ID, user_nicename, display_name, _groupby, SUM(_count) as count FROM (
     273                        SELECT p.prop_name, u.ID, u.user_nicename, u.display_name,
     274                            IFNULL(p.user_id,p.prop_name) as _groupby, COUNT(*) as _count
    262275                        FROM {$details['props_table']} p
    263276                            LEFT JOIN {$details['rev_table']} r ON p.revision = r.id
    264277                            LEFT JOIN {$wpdb->users} u ON p.user_id = u.ID
    265                         WHERE $where
     278                        WHERE $where AND p.prop_name != r.author
    266279                        GROUP BY _groupby
    267                     UNION
    268                         SELECT r.author as prop_name, u.user_nicename, u.display_name, u.ID, u.ID as _groupby
     280
     281                        UNION
     282
     283                        SELECT r.author as prop_name, u.ID, u.user_nicename, u.display_name,
     284                            u.ID as _groupby, COUNT(*) as _count
    269285                        FROM {$details['rev_table']} r
    270286                            LEFT JOIN {$wpdb->users} u ON r.author = u.user_login
    271287                        WHERE $where
    272                         ORDER BY prop_name ASC"
    273                 );
    274 
    275 
    276                 echo "<p>Props (Contributors + Committers bunched together) designed to be copy-pasted elsewhere. Set gravatar size via adding <a href='$url&size=96'>&size=96</a> to this URL.</p>";
     288                        GROUP BY _groupby
     289                    ) results
     290                    GROUP BY _groupby
     291                    ORDER BY count DESC"
     292                );
     293
     294
     295                echo "<p>Props (Contributors + Committers bunched together) designed to be copy-pasted elsewhere.<br>
     296                Set gravatar size via adding <a href='$url&size=96'>&size=96</a> to this URL.<br>
     297                Note: A committer prop'ing themselves only counts for 1 here.</p>";
    277298
    278299                echo '<table class="widefat striped">';
    279                 echo '<thead><tr><th>ID</th><th>Name</th><th>DisplayName</th><th>Profile URL</th><th>Gravatar</th><th>GravURL</th></tr></thead>';
     300                echo '<thead><tr><th>ID</th><th>Name</th><th>DisplayName</th><th>Count</th><th>Profile URL</th><th>Gravatar</th><th>GravURL</th></tr></thead>';
    280301                foreach ( $details as $c ) {
    281302                    $link = add_query_arg(
     
    287308                    );
    288309                    printf(
    289                         '<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>',
     310                        '<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>',
    290311                        $c->ID,
    291312                        $c->prop_name,
    292313                        $c->display_name,
     314                        $c->count,
    293315                        make_clickable( $c->user_nicename ? 'https://profile.wordpress.org/' . $c->user_nicename . '/' : '' ),
    294316                        $c->ID ? get_avatar( $c->ID, min( 96, $_GET['size'] ?? 32 ) ) : '',
Note: See TracChangeset for help on using the changeset viewer.