Skip to content

Commit 1a2ef39

Browse files
committed
Translate: Stats: Expect that these queries will likely fail.
git-svn-id: https://meta.svn.wordpress.org/sites/trunk@14919 74240141-8908-4e6f-9713-ba540dce6ec7
1 parent 5f1d944 commit 1a2ef39

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

  • wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/cli

‎wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/cli/class-stats.php‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -702,12 +702,6 @@ private function print_total_translations_translators_by_year() {
702702
$first_id = 0;
703703

704704
for ( $year = $last_year; $year > $first_year; $year -- ) {
705-
if ( gmdate( 'Y' ) == $year ) {
706-
$last_id = $wpdb->get_var( "SELECT MAX(id) FROM {$wpdb->gp_translations}" );
707-
} else {
708-
$last_id = $first_id - 1;
709-
}
710-
711705
$first_id = $wpdb->get_var(
712706
$wpdb->prepare(
713707
"SELECT MIN(id) FROM {$wpdb->gp_translations} WHERE date_added BETWEEN %s AND %s",
@@ -716,6 +710,12 @@ private function print_total_translations_translators_by_year() {
716710
)
717711
);
718712

713+
if ( gmdate( 'Y' ) == $year ) {
714+
$last_id = $wpdb->get_var( "SELECT MAX(id) FROM {$wpdb->gp_translations}" );
715+
} else {
716+
$last_id = $first_id - 1;
717+
}
718+
719719
$row = $wpdb->get_row(
720720
$wpdb->prepare(
721721
"SELECT
@@ -744,16 +744,16 @@ private function print_total_translations_translators_by_year() {
744744
);
745745

746746
if ( gmdate( 'Y' ) == $year ) {
747-
$strings_added = str_pad( number_format_i18n( $this->estimate_value_for_full_year( $row['strings_added'] ) ), 10, ' ', STR_PAD_LEFT );
748-
$contributors = str_pad( number_format_i18n( $this->estimate_value_for_full_year( $row['contributors'] ) ), 6, ' ', STR_PAD_LEFT );
749-
$repeat_contributors = str_pad( number_format_i18n( $this->estimate_value_for_full_year( $repeat_contributors_val ) ), 8, ' ', STR_PAD_LEFT );
747+
$strings_added = str_pad( number_format_i18n( $this->estimate_value_for_full_year( $row['strings_added'] ?? 0 ) ), 10, ' ', STR_PAD_LEFT );
748+
$contributors = str_pad( number_format_i18n( $this->estimate_value_for_full_year( $row['contributors'] ?? 0 ) ), 6, ' ', STR_PAD_LEFT );
749+
$repeat_contributors = str_pad( number_format_i18n( $this->estimate_value_for_full_year( $repeat_contributors_val ?? 0 ) ), 8, ' ', STR_PAD_LEFT );
750750
$code .= "{$year} (*) \t {$strings_added} \t\t\t {$contributors} \t {$repeat_contributors}" . PHP_EOL;
751751
}
752-
$strings_added = number_format_i18n( $row['strings_added'] );
753-
$contributors = number_format_i18n( $row['contributors'] );
752+
$strings_added = number_format_i18n( $row['strings_added'] ?? 0 );
753+
$contributors = number_format_i18n( $row['contributors'] ?? 0 );
754754
$strings_added = str_pad( $strings_added, 10, ' ', STR_PAD_LEFT );
755755
$contributors = str_pad( $contributors, 6, ' ', STR_PAD_LEFT );
756-
$repeat_contributors = str_pad( number_format_i18n( $repeat_contributors_val ), 8, ' ', STR_PAD_LEFT );
756+
$repeat_contributors = str_pad( number_format_i18n( $repeat_contributors_val ?? 0 ), 8, ' ', STR_PAD_LEFT );
757757
$code .= "{$year} \t\t {$strings_added} \t\t\t {$contributors} \t {$repeat_contributors}" . PHP_EOL;
758758
}
759759

0 commit comments

Comments
 (0)