mirror of https://github.com/zulip/zulip.git
analytics: Convert datetime to UNIX timestamp before JSON serialization.
datetime objects are not ordinarily JSON serializable. While both ujson and orjson have special cases to serialize datetime objects, they do it in different ways. So we want to do this explicitly. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
219fc36051
commit
02fcb75ded
|
@ -301,7 +301,10 @@ def get_chart_data(request: HttpRequest, user_profile: UserProfile, chart_name:
|
||||||
|
|
||||||
assert len({stat.frequency for stat in stats}) == 1
|
assert len({stat.frequency for stat in stats}) == 1
|
||||||
end_times = time_range(start, end, stats[0].frequency, min_length)
|
end_times = time_range(start, end, stats[0].frequency, min_length)
|
||||||
data: Dict[str, Any] = {'end_times': end_times, 'frequency': stats[0].frequency}
|
data: Dict[str, Any] = {
|
||||||
|
'end_times': [int(end_time.timestamp()) for end_time in end_times],
|
||||||
|
'frequency': stats[0].frequency,
|
||||||
|
}
|
||||||
|
|
||||||
aggregation_level = {
|
aggregation_level = {
|
||||||
InstallationCount: 'everyone',
|
InstallationCount: 'everyone',
|
||||||
|
|
Loading…
Reference in New Issue