Sort rows on the activity report by realm/count.

(imported from commit ed1db1b7685dc113acb8a6a8317b7b84d10c440b)
This commit is contained in:
Steve Howell 2013-09-24 16:31:30 -04:00
parent 95ceba2828
commit b1ef9a686c
1 changed files with 2 additions and 1 deletions

View File

@ -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'