Jdlrobson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354490 )

Change subject: BECOME MODERN!! Use const/let
......................................................................

BECOME MODERN!! Use const/let

Change-Id: I4b47d9d996dcab9893c8e177fab245699ff031b6
---
M lib/EventProcessor.js
1 file changed, 16 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/trending-edits 
refs/changes/90/354490/1

diff --git a/lib/EventProcessor.js b/lib/EventProcessor.js
index 2565920..0c3899f 100644
--- a/lib/EventProcessor.js
+++ b/lib/EventProcessor.js
@@ -79,14 +79,14 @@
      * @return {Boolean} whether the given edit event has been processed
      */
     process(edit) {
-        var contributors;
-        var page;
-        var id = edit.page_id;
-        var ts = new Date(edit.rev_timestamp);
-        var performer = edit.performer;
-        var isAnon = edit.performer.user_id === undefined;
-        var username = performer.user_text;
-        var topic = edit.meta.topic;
+        let contributors;
+        let page;
+        const id = edit.page_id;
+        const ts = new Date(edit.rev_timestamp);
+        const performer = edit.performer;
+        const isAnon = edit.performer.user_id === undefined;
+        const username = performer.user_text;
+        const topic = edit.meta.topic;
         const pages = this.pages;
         const isBot = performer.user_is_bot;
 
@@ -128,7 +128,7 @@
                     domain: edit.meta.domain
                 };
             }
-            var bytesChanged = edit.rev_len - page.rev_len;
+            let bytesChanged = edit.rev_len - page.rev_len;
             if (!isBot) {
                 page.edits++;
                 page.updated = ts;
@@ -171,14 +171,14 @@
     purge(date) {
         const options = this.purgeOptions;
         const trendDefinition = options.trends_at;
-        var time = date.getTime();
-        var maxAgeDate = new Date(time - options.max_age * 60000);
-        var maxInactivityDate = new Date(time - options.max_inactivity * 
60000);
-        var pages = this.pages;
+        let time = date.getTime();
+        let maxAgeDate = new Date(time - options.max_age * 60000);
+        let maxInactivityDate = new Date(time - options.max_inactivity * 
60000);
+        let pages = this.pages;
 
         pages.forEach((page) => {
-            var timePassed = (date - page.from) / 60000;
-            var speed = timePassed > 0 ? page.edits / timePassed : page.edits;
+            let timePassed = (date - page.from) / 60000;
+            let speed = timePassed > 0 ? page.edits / timePassed : page.edits;
             if (page.updated < maxInactivityDate || page.from < maxAgeDate) {
                 remove(pages, page.id);
             } else if (speed < options.min_speed) {
@@ -194,7 +194,7 @@
             }
         });
 
-        var size = pages.size;
+        let size = pages.size;
         // Only do this if we have to
         if (size > options.max_pages) {
             this.getPages().sort(function(a, b) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4b47d9d996dcab9893c8e177fab245699ff031b6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/trending-edits
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>

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

Reply via email to