mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 20:33:53 +01:00
Minor changes to user_daily_visits
(#10324)
* Use fake time in tests in _get_start_of_day. * Change the inequality of last_seen in user_daily_visits Co-authored-by: Erik Johnston <erik@matrix.org>
This commit is contained in:
parent
225be77787
commit
aa78064869
2 changed files with 3 additions and 2 deletions
1
changelog.d/10324.misc
Normal file
1
changelog.d/10324.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Minor change to the code that populates `user_daily_visits`.
|
|
@ -320,7 +320,7 @@ class ServerMetricsStore(EventPushActionsWorkerStore, SQLBaseStore):
|
||||||
"""
|
"""
|
||||||
Returns millisecond unixtime for start of UTC day.
|
Returns millisecond unixtime for start of UTC day.
|
||||||
"""
|
"""
|
||||||
now = time.gmtime()
|
now = time.gmtime(self._clock.time())
|
||||||
today_start = calendar.timegm((now.tm_year, now.tm_mon, now.tm_mday, 0, 0, 0))
|
today_start = calendar.timegm((now.tm_year, now.tm_mon, now.tm_mday, 0, 0, 0))
|
||||||
return today_start * 1000
|
return today_start * 1000
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ class ServerMetricsStore(EventPushActionsWorkerStore, SQLBaseStore):
|
||||||
) udv
|
) udv
|
||||||
ON u.user_id = udv.user_id AND u.device_id=udv.device_id
|
ON u.user_id = udv.user_id AND u.device_id=udv.device_id
|
||||||
INNER JOIN users ON users.name=u.user_id
|
INNER JOIN users ON users.name=u.user_id
|
||||||
WHERE last_seen > ? AND last_seen <= ?
|
WHERE ? <= last_seen AND last_seen < ?
|
||||||
AND udv.timestamp IS NULL AND users.is_guest=0
|
AND udv.timestamp IS NULL AND users.is_guest=0
|
||||||
AND users.appservice_id IS NULL
|
AND users.appservice_id IS NULL
|
||||||
GROUP BY u.user_id, u.device_id
|
GROUP BY u.user_id, u.device_id
|
||||||
|
|
Loading…
Reference in a new issue