Add "Total sent" column to /realm_activity.

(imported from commit 1623f01ee18317af3e9af5359e089b4c9a1c64f4)
This commit is contained in:
Steve Howell 2013-11-01 14:31:06 -04:00
parent 0ca84ea981
commit e65139b5a4

View File

@ -2546,23 +2546,31 @@ def realm_user_summary_table(all_records):
else:
return ''
def get_count(user_summary, k):
if k in user_summary:
return user_summary[k]['count']
else:
return ''
rows = []
for email, user_summary in user_records.items():
email_link = '<a href="/user_activity/%s/">%s</a>' % (email, email)
email_link = mark_safe(email_link)
row = [email_link]
sent_count = get_count(user_summary, 'send')
row = [email_link, sent_count]
for field in ['use', 'send', 'pointer', 'desktop', 'iPhone', 'Android']:
val = get_last_visit(user_summary, field)
row.append(val)
rows.append(row)
def by_used_time(row):
return row[1]
return row[2]
rows = sorted(rows, key=by_used_time, reverse=True)
cols = [
'Email',
'Total sent',
'Heard from',
'Message sent',
'Pointer motion',