mirror of https://github.com/zulip/zulip.git
Split out bot counts
(imported from commit 2e5afae98a28774f555c45019ebbba778160962b)
This commit is contained in:
parent
276e14e06a
commit
f0512e91e0
|
@ -7,6 +7,7 @@
|
|||
<th>Domain</th>
|
||||
<th>Active users</th>
|
||||
<th>Total users</th>
|
||||
<th>Bots</th>
|
||||
<th>Hours</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -32,6 +33,11 @@
|
|||
{{ row.user_profile_count }}
|
||||
</td>
|
||||
|
||||
{# Bots #}
|
||||
<td class="number">
|
||||
{{ row.bot_count }}
|
||||
</td>
|
||||
|
||||
{# Hours #}
|
||||
<td class="number">
|
||||
{{ row.hours }}
|
||||
|
|
|
@ -1879,7 +1879,16 @@ def realm_summary_table(realm_minutes):
|
|||
FROM zerver_userprofile up
|
||||
WHERE up.realm_id = realm.id
|
||||
AND is_active
|
||||
) user_profile_count
|
||||
AND not is_bot
|
||||
) user_profile_count,
|
||||
(
|
||||
SELECT
|
||||
count(*)
|
||||
FROM zerver_userprofile up
|
||||
WHERE up.realm_id = realm.id
|
||||
AND is_active
|
||||
AND is_bot
|
||||
) bot_count
|
||||
FROM zerver_realm realm
|
||||
LEFT OUTER JOIN
|
||||
(
|
||||
|
@ -1936,14 +1945,17 @@ def realm_summary_table(realm_minutes):
|
|||
# create totals
|
||||
total_active_user_count = 0
|
||||
total_user_profile_count = 0
|
||||
total_bot_count = 0
|
||||
for row in rows:
|
||||
total_active_user_count += int(row['active_user_count'])
|
||||
total_user_profile_count += int(row['user_profile_count'])
|
||||
total_bot_count += int(row['bot_count'])
|
||||
|
||||
rows.append(dict(
|
||||
domain='Total',
|
||||
active_user_count=total_active_user_count,
|
||||
user_profile_count=total_user_profile_count,
|
||||
bot_count=total_bot_count,
|
||||
hours=int(total_hours)
|
||||
))
|
||||
|
||||
|
|
Loading…
Reference in New Issue