mirror of https://github.com/zulip/zulip.git
activity: Show the time the data is from.
I've wanted this when looking at a tab from the day before. Also provides the date and time in UTC, which is handy for interpreting some of the data. Pretty sure this is not the world's cleanest way to do this in the front-end code. It'll do for now.
This commit is contained in:
parent
bdea0960de
commit
20b2c11830
|
@ -287,6 +287,8 @@ def get_realm_day_counts() -> Dict[str, Dict[str, str]]:
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def realm_summary_table(realm_minutes: Dict[str, float]) -> str:
|
def realm_summary_table(realm_minutes: Dict[str, float]) -> str:
|
||||||
|
now = timezone_now()
|
||||||
|
|
||||||
query = '''
|
query = '''
|
||||||
SELECT
|
SELECT
|
||||||
realm.string_id,
|
realm.string_id,
|
||||||
|
@ -397,7 +399,7 @@ def realm_summary_table(realm_minutes: Dict[str, float]) -> str:
|
||||||
|
|
||||||
for row in rows:
|
for row in rows:
|
||||||
row['date_created_day'] = row['date_created'].strftime('%Y-%m-%d')
|
row['date_created_day'] = row['date_created'].strftime('%Y-%m-%d')
|
||||||
row['age_days'] = int((timezone_now() - row['date_created']).total_seconds()
|
row['age_days'] = int((now - row['date_created']).total_seconds()
|
||||||
/ 86400)
|
/ 86400)
|
||||||
row['is_new'] = row['age_days'] < 12 * 7
|
row['is_new'] = row['age_days'] < 12 * 7
|
||||||
|
|
||||||
|
@ -455,7 +457,8 @@ def realm_summary_table(realm_minutes: Dict[str, float]) -> str:
|
||||||
|
|
||||||
content = loader.render_to_string(
|
content = loader.render_to_string(
|
||||||
'analytics/realm_summary_table.html',
|
'analytics/realm_summary_table.html',
|
||||||
dict(rows=rows, num_active_sites=num_active_sites)
|
dict(rows=rows, num_active_sites=num_active_sites,
|
||||||
|
now=now.strftime('%Y-%m-%dT%H:%M:%SZ'))
|
||||||
)
|
)
|
||||||
return content
|
return content
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
<h2 style="text-align: center;">{{ num_active_sites }} active sites</h2>
|
<h2 style="text-align: center;">{{ num_active_sites }} active sites</h2>
|
||||||
|
|
||||||
|
<p id="utctime" style="text-align: center;"></p>
|
||||||
|
<p id="localtime" style="text-align: center;"></p>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var now = moment('{{ now }}');
|
||||||
|
$('#utctime')[0].innerHTML = moment.utc(now).format('YYYY-MM-DD HH:mm') + 'Z';
|
||||||
|
$('#localtime')[0].innerHTML = '(' + now.format('YYYY-MM-DD HH:mm ZZ') + ')';
|
||||||
|
</script>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><strong>active (site)</strong> - has ≥5 DAUs</li>
|
<li><strong>active (site)</strong> - has ≥5 DAUs</li>
|
||||||
<li>sites are listed if ≥1 users active in last 2 weeks</li>
|
<li>sites are listed if ≥1 users active in last 2 weeks</li>
|
||||||
|
|
Loading…
Reference in New Issue