Changeset 2667 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/routes/locale.php
- Timestamp:
- 03/02/2016 02:54:02 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/routes/locale.php
r2663 r2667 335 335 336 336 // Get the names of the contributors. 337 foreach ( $contributors as $contributor _id) {338 if ( isset( $locale_contributors['editors'][ $contributor _id ] ) ) {337 foreach ( $contributors as $contributor ) { 338 if ( isset( $locale_contributors['editors'][ $contributor->user_id ] ) ) { 339 339 continue; 340 340 } 341 341 342 if ( isset( $locale_contributors['contributors'][ $contributor_id ] ) ) { 342 343 if ( isset( $locale_contributors['contributors'][ $contributor->user_id ] ) ) { 344 // Update last updated and counts per status. 345 $locale_contributors['contributors'][ $contributor->user_id ]->last_update = max( 346 $locale_contributors['contributors'][ $contributor->user_id ]->last_update, 347 $contributor->last_update 348 ); 349 350 $locale_contributors['contributors'][ $contributor->user_id ]->total_count += $contributor->total_count; 351 $locale_contributors['contributors'][ $contributor->user_id ]->current_count += $contributor->current_count; 352 $locale_contributors['contributors'][ $contributor->user_id ]->waiting_count += $contributor->waiting_count; 353 $locale_contributors['contributors'][ $contributor->user_id ]->fuzzy_count += $contributor->fuzzy_count; 343 354 continue; 344 355 } 345 356 346 $user = get_user_by( 'id', $contributor _id );357 $user = get_user_by( 'id', $contributor->user_id ); 347 358 if ( ! $user ) { 348 359 continue; 349 360 } 350 361 351 $locale_contributors['contributors'][ $contributor_id ] = (object) array( 352 'nicename' => $user->user_nicename, 353 'display_name' => $this->_encode( $user->display_name ), 354 'email' => $user->user_email, 362 $locale_contributors['contributors'][ $contributor->user_id ] = (object) array( 363 'nicename' => $user->user_nicename, 364 'display_name' => $this->_encode( $user->display_name ), 365 'email' => $user->user_email, 366 'last_update' => $contributor->last_update, 367 'total_count' => $contributor->total_count, 368 'current_count' => $contributor->current_count, 369 'waiting_count' => $contributor->waiting_count, 370 'fuzzy_count' => $contributor->fuzzy_count, 355 371 ); 356 372 } 357 373 unset( $contributors ); 374 375 uasort( $locale_contributors['contributors'], array( $this, '_sort_contributors_by_total_count_callback' ) ); 358 376 359 377 return $locale_contributors; … … 369 387 global $wpdb; 370 388 371 $user_ids = $wpdb->get_col( $wpdb->prepare( " 372 SELECT DISTINCT( `user_id` ) 389 $contributors = $wpdb->get_results( $wpdb->prepare( " 390 SELECT 391 `user_id`, 392 MAX( `date_added` ) AS `last_update`, 393 COUNT( * ) as `total_count`, 394 COUNT( CASE WHEN `status` = 'current' THEN `status` END ) AS `current_count`, 395 COUNT( CASE WHEN `status` = 'waiting' THEN `status` END ) AS `waiting_count`, 396 COUNT( CASE WHEN `status` = 'fuzzy' THEN `status` END ) AS `fuzzy_count` 373 397 FROM `{$wpdb->gp_translations}` 374 398 WHERE 375 399 `translation_set_id` = %d 376 400 AND `user_id` IS NOT NULL AND `user_id` != 0 377 AND `status` <> 'rejected'401 AND `status` IN( 'current', 'waiting', 'fuzzy' ) 378 402 AND `date_modified` > %s 403 GROUP BY `user_id` 379 404 ", $translation_set->id, date( 'Y-m-d', time() - YEAR_IN_SECONDS ) ) ); 380 405 381 return $ user_ids;406 return $contributors; 382 407 } 383 408 … … 731 756 } 732 757 758 private function _sort_contributors_by_total_count_callback( $a, $b ) { 759 return $a->total_count < $b->total_count; 760 } 761 733 762 private function _sort_reverse_name_callback( $a, $b ) { 734 763 // The Waiting project should always be first.
Note: See TracChangeset
for help on using the changeset viewer.