From b1ef9a686c52d3dbfa0152f1f4f75d0536a48e7b Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Tue, 24 Sep 2013 16:31:30 -0400 Subject: [PATCH] Sort rows on the activity report by realm/count. (imported from commit ed1db1b7685dc113acb8a6a8317b7b84d10c440b) --- zerver/views/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zerver/views/__init__.py b/zerver/views/__init__.py index babbceb460..331a5ca5f7 100644 --- a/zerver/views/__init__.py +++ b/zerver/views/__init__.py @@ -1822,7 +1822,8 @@ class ActivityTable(object): row['age'] = age def sorted_rows(self): - return sorted(self.rows.iteritems(), key=lambda (k,r): r['age']) + keyfunc = lambda (k,r): (r['realm'], -1 * r.get('send_message_count', 0)) + return sorted(self.rows.iteritems(), key=keyfunc) def can_view_activity(request): return request.user.realm.domain == 'zulip.com'