Ejegg has uploaded a new change for review.

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

Change subject: Remove default filter, add 'ago' options
......................................................................

Remove default filter, add 'ago' options

You can now use $filter=MonthsAgo lt 2 to get things less than two
months old.  This allows saving configurations relative to the
current date.

Change-Id: Ief0526dc127fd80a51afc717b6c4309ac6e70567
---
M widgets/x-by-y.js
1 file changed, 27 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/dash 
refs/changes/76/194176/1

diff --git a/widgets/x-by-y.js b/widgets/x-by-y.js
index cc1715d..98d8afb 100644
--- a/widgets/x-by-y.js
+++ b/widgets/x-by-y.js
@@ -145,28 +145,33 @@
                        values: [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ],
                        labels: [ 'Completed', 'Pending', 'Cancelled', 
'Failed', 'In Progress', 'Overdue', 'Settled', 'Paid', 'Refunded' ],
                        canGroup: true
-               }
-       },
-       defaultFilter: {
-               type: 'and',
-               left: {
-                       type: 'eq',
-                       left: { type: 'property', name: 'Year' },
-                       right: { type: 'literal', value: '2014' }
                },
-               right: {
-                       type: 'and',
-                       left: {
-                               type: 'eq',
-                               left: { type: 'property', name: 'Month' },
-                               right: { type: 'literal', value: '12' }
-                       },
-                       right: {
-                               type: 'lt',
-                               left: { type: 'property', name: 'Amount' },
-                               right: { type: 'literal', value: '5000' }
-                       }
+               YearsAgo: {
+                       table: 'cc',
+                       column : 'receive_date',
+                       func: 'timestampdiff(YEAR, [[COL]], utc_timestamp())',
+                       display: 'Years ago',
+                       type: 'number',
+                       min: 0,
+                       max: 12
+               },
+               MonthsAgo: {
+                       table: 'cc',
+                       column : 'receive_date',
+                       func: 'timestampdiff(MONTH, [[COL]], utc_timestamp())',
+                       display: 'Months ago',
+                       type: 'number',
+                       min: 0,
+                       max: 10000
+               },
+               DaysAgo: {
+                       table: 'cc',
+                       column : 'receive_date',
+                       func: 'timestampdiff(DAY, [[COL]], utc_timestamp())',
+                       display: 'Days ago',
+                       type: 'number',
+                       min: 0,
+                       max: 10000
                }
-       },
-       defaultGroup: ['Day']
+       }
 };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ief0526dc127fd80a51afc717b6c4309ac6e70567
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/dash
Gerrit-Branch: master
Gerrit-Owner: Ejegg <eeggles...@wikimedia.org>

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

Reply via email to