Santhosh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/275368

Change subject: Trend API: Make sure to return data for current week even if no 
translation
......................................................................

Trend API: Make sure to return data for current week even if no translation

The data filling in ApiQueryContentTranslationLanguageTrend was stopping
at last known week with non-zero translation. That will cause 'Last week'
translation going wrong if accessed using array indexes.

This commit make sure that data is filled including current week, no
matter whether translations(published/in progress/deleted) exist or not.

Bug: T129053
Change-Id: I6b51dc768274952d5a32aed2b450242b6f45e410
---
M api/ApiQueryContentTranslationLanguageTrend.php
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/68/275368/1

diff --git a/api/ApiQueryContentTranslationLanguageTrend.php 
b/api/ApiQueryContentTranslationLanguageTrend.php
index 1fdae20..448000c 100644
--- a/api/ApiQueryContentTranslationLanguageTrend.php
+++ b/api/ApiQueryContentTranslationLanguageTrend.php
@@ -55,10 +55,10 @@
                foreach ( $data as $column ) {
                        foreach ( array_keys( $column ) as $date ) {
                                $min = min( $min, strtotime( $date ) );
-                               $max = max( $max, strtotime( $date ) );
                        }
                }
-
+               // We need statistics till the beginning of the week.
+               $max = strtotime( 'next Sunday', time() );
                $counts = array();
                foreach ( array_keys( $data ) as $type ) {
                        $counts[$type] = 0;

-- 
To view, visit https://gerrit.wikimedia.org/r/275368
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6b51dc768274952d5a32aed2b450242b6f45e410
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to