Rfaulk has submitted this change and it was merged.

Change subject: mod. (bz 48341) remove 'ban' field add 'is_blocked' (bool).
......................................................................


mod. (bz 48341) remove 'ban' field add 'is_blocked' (bool).

Change-Id: If6d569755784c52beb30d7b64e77fa7a27afbe55
---
M user_metrics/metrics/blocks.py
1 file changed, 12 insertions(+), 8 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved



diff --git a/user_metrics/metrics/blocks.py b/user_metrics/metrics/blocks.py
index 7bb7e22..a53a2c0 100644
--- a/user_metrics/metrics/blocks.py
+++ b/user_metrics/metrics/blocks.py
@@ -70,14 +70,14 @@
     def __init__(self, **kwargs):
         super(Blocks, self).__init__(**kwargs)
 
-
+    # TODO: remove ban.  add is_blocked.
     @staticmethod
     def header():
         return ['user_id',
+                'is_blocked',
                 'block_count',
                 'block_first',
-                'block_last',
-                'ban']
+                'block_last']
 
     @um.UserMetric.pre_process_metric_call
     def process(self, users, **kwargs):
@@ -97,8 +97,10 @@
         rowValues = {}
 
         for i in xrange(len(users)):
-            rowValues[users[i]] = {'block_count': 0, 'block_first': -1,
-                                   'block_last': -1, 'ban': -1}
+            rowValues[users[i]] = {'is_blocked': 0,
+                                   'block_count': 0,
+                                   'block_first': -1,
+                                   'block_last': -1}
         # Data calls
         user_map = query_mod.blocks_user_map_query(users, self.project)
         query_args = namedtuple('QueryArgs', 'date_start')(self.datetime_start)
@@ -116,16 +118,18 @@
 
             if type == "block":
                 rowValues[userid]['block_count'] = count
+                rowValues[userid]['is_blocked'] = count > 0
                 rowValues[userid]['block_first'] = first
                 rowValues[userid]['block_last'] = last
 
             elif type == "ban":
                 rowValues[userid][type] = first
 
-        self._results = [[user, rowValues.get(user)['block_count'],
+        self._results = [[user,
+                          rowValues.get(user)['is_blocked'],
+                          rowValues.get(user)['block_count'],
                           rowValues.get(user)['block_first'],
-                          rowValues.get(user)['block_last'],
-                          rowValues.get(user)['ban']]
+                          rowValues.get(user)['block_last']]
                          for user in rowValues.keys()]
         return self
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If6d569755784c52beb30d7b64e77fa7a27afbe55
Gerrit-PatchSet: 1
Gerrit-Project: analytics/user-metrics
Gerrit-Branch: master
Gerrit-Owner: Rfaulk <[email protected]>
Gerrit-Reviewer: Rfaulk <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to