Nikerabbit has uploaded a new change for review.
https://gerrit.wikimedia.org/r/234964
Change subject: Preparations for showing trend line instead of cumulative
published articles
......................................................................
Preparations for showing trend line instead of cumulative published articles
Fixed one bug in trend boxes and removed commented out line as well.
Bug: T105192
Change-Id: Ie1a15271346d90189ed94725a6bbca516264cc47
---
M includes/Translation.php
M modules/stats/ext.cx.stats.js
2 files changed, 12 insertions(+), 7 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation
refs/changes/64/234964/1
diff --git a/includes/Translation.php b/includes/Translation.php
index 0eedb85..c0a7c98 100644
--- a/includes/Translation.php
+++ b/includes/Translation.php
@@ -270,16 +270,21 @@
$groupBy
);
+ $prev = 0;
$result = array();
foreach ( $rows as $row ) {
+ $count = (int)$row->translatons_count;
$result[] = array(
'date' => $interval === 'week' ?
// Week end date
date( 'Y-m-d', strtotime( $row->date .
' + ' .
( 6 - date( 'w', strtotime(
$row->date ) ) ) . ' days' ) ) :
date( 'Y-m', strtotime( $row->date ) ),
- 'count' => $row->translatons_count,
+ 'count' => $count,
+ 'delta' => $count - $prev,
);
+
+ $prev = $count;
}
return $result;
diff --git a/modules/stats/ext.cx.stats.js b/modules/stats/ext.cx.stats.js
index aec5f71..15bd6fc 100644
--- a/modules/stats/ext.cx.stats.js
+++ b/modules/stats/ext.cx.stats.js
@@ -53,7 +53,7 @@
self.languageTranslationTrend = languageTrend;
self.languageTranslationTrend = mergeAndFill(
totalTrend, languageTrend );
self.renderHighlights();
- self.drawGraph();
+ self.drawGraph( 'count' );
} );
this.getCXStats().then( function ( data ) {
if ( !data || !data.query ) {
@@ -77,7 +77,7 @@
$parenthesizedTrend, $trendInLanguage,
fmt = mw.language.convertNumber; // Shortcut
- if ( this.totalTranslationTrend.length < 3 ) {
+ if ( this.totalTranslationTrend.length < 4 ) {
// Trend calculation works only if we have enough data
return;
}
@@ -424,7 +424,7 @@
} );
};
- CXStats.prototype.drawGraph = function () {
+ CXStats.prototype.drawGraph = function ( type ) {
var data, cxTrendGraph, ctx;
ctx = this.$graph[ 0 ].getContext( '2d' );
@@ -439,7 +439,7 @@
strokeColor: '#FD6E8A',
pointColor: '#FD6E8A',
data: $.map(
this.totalTranslationTrend, function ( data ) {
- return data.count;
+ return data[type];
} )
},
{
@@ -450,7 +450,7 @@
strokeColor: '#80B3FF',
pointColor: '#80B3FF',
data: $.map(
this.languageTranslationTrend, function ( data ) {
- return data.count;
+ return data[type];
} )
}
]
@@ -474,7 +474,7 @@
this.targetSourceModel.draft = {};
this.sourceTargetModel.published = {};
this.targetSourceModel.published = {};
- // sourceModel['count']={};
+
for ( i = 0; i < records.pages.length; i++ ) {
record = records.pages[ i ];
status = record.status;
--
To view, visit https://gerrit.wikimedia.org/r/234964
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie1a15271346d90189ed94725a6bbca516264cc47
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits