WordPress.org

Making WordPress.org

Changeset 1885


Ignore:
Timestamp:
09/18/2015 12:54:38 AM (4 years ago)
Author:
dd32
Message:

Translate: Stats overview: Add the Forums and Waiting projects to the table. The Waiting column shows the number of strings waiting.
I attempted to add the Colour coding to the waiting list, but a straight percentage calculation isn't the best option, it needs to use a logarithemtric scale, on a percentage scale those with 500 waiting strings look great compared to 2000.
See #1202

Location:
sites/trunk/translate.wordpress.org
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-stats-overview.php

    r1881 r1885  
    3232            'meta/themes' => false,
    3333            'meta/plugins' => false,
     34            'meta/forums' => false,
    3435            'apps/android' => false,
    35             'apps/ios' => false
     36            'apps/ios' => false,
     37            'waiting' => false,
    3638        );
    3739
     
    5456        $sql = "SELECT
    5557                path, locale, locale_slug,
    56                 (100 * stats.current/stats.all) as percent_complete
     58                (100 * stats.current/stats.all) as percent_complete,
     59                stats.waiting+stats.fuzzy as waiting_strings
    5760            FROM {$gpdb->prefix}project_translation_status stats
    5861                LEFT JOIN {$gpdb->prefix}projects p ON stats.project_id = p.id
     
    7073            }
    7174            $translation_locale_statuses[ $locale_key ][ $set->path ] = floor( (float) $set->percent_complete );
     75            $translation_locale_statuses[ $locale_key ]['waiting'] += (int) $set->waiting_strings;
    7276        }
    7377        unset( $rows, $locale_key, $set );
     
    7680        $translation_locale_complete = array();
    7781        foreach ( $translation_locale_statuses as $locale => $sets ) {
     82            unset( $sets['waiting'] );
    7883            $translation_locale_complete[ $locale ] = round( array_sum( $sets ) / count( $sets ), 3 );
    7984        }
  • sites/trunk/translate.wordpress.org/public_html/gp-templates/stats-overview.php

    r1859 r1885  
    5151                            $percent = $translation_locale_statuses[ $locale_slug ][ $project->path ];
    5252
    53                             $percent_class = 'percent' . (int) ( $percent / 10 ) * 10;
    54                             echo '<td class="' . $percent_class .'"><a href="' . $projecturl . '">' . $percent . '%</a></td>';
     53                            if ( 'waiting' === $project->path  ) {
     54                                echo '<td><a href="' . $projecturl . '">' . number_format( $percent ) . '</a></td>';
     55                            } else {
     56                                $percent_class = 'percent' . (int) ( $percent / 10 ) * 10;
     57                                echo '<td class="' . $percent_class .'"><a href="' . $projecturl . '">' . $percent . '%</a></td>';
     58                            }
    5559
    5660                        } else {
Note: See TracChangeset for help on using the changeset viewer.