Skip to content

Commit e3da5e2

Browse files
committed
docs: Fix example accounting sql query
1 parent a2a59bd commit e3da5e2

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

docs/accounting.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ was used to create the meeting, the owning tenant (`tenant_fk`), and three metri
6464
named `users`, `voice` and `video`.
6565

6666
Here is an (untested) example PostgreSQL query returning some useful aggregations. It
67-
fetches all rows in a certain time range, calculate min/max/average values per meeting
67+
fetches all rows in a certain time range, calculates min/max/avg values per meeting
6868
(per `uuid`), then groups those together by `tenant_fk` to get meaningfull aggregated
6969
values per tenant:
7070

@@ -81,18 +81,18 @@ values per tenant:
8181
/* Maximum meeting size */
8282
MAX(users_max),
8383
/* Number of meetings with more than 100 users peak */
84-
COUNT(CASE WHEN users_max > 100 THEN 1 END)
84+
COUNT(CASE WHEN users_max > 100 THEN 1 END),
8585
/* Number of meetings */
86-
COUNT(*),
86+
COUNT(*)
8787
FROM (
8888
SELECT
8989
tenant_fk,
9090
uuid,
91-
MAX(ts) - MIN(ts) as duration
92-
AVG(users) AS users_avg
91+
MAX(ts) - MIN(ts) as duration,
92+
AVG(users) AS users_avg,
9393
MAX(users) AS users_max
9494
FROM meeting_stats
95-
WHERE ts::date <@ '[2027-01-01,2027-02-01)'::daterange
95+
WHERE ts::date <@ '[2026-02-01,2026-03-01)'::daterange
9696
GROUP BY tenant_fk, uuid
9797
)
9898
INNER JOIN tenants ON (tenant_fk = tenants.id)

0 commit comments

Comments
 (0)