openreplay/api/chalicelib/utils/metrics_helper.py
Kraiem Taha Yassine aad8542d97
Dev (#2911)
* feat(chalice): autocomplete return top 10 with stats

* fix(chalice): fixed autocomplete top 10 meta-filters

* fix(chalice): support low-density for cards
2024-12-26 13:23:19 +01:00

7 lines
289 B
Python

def get_step_size(startTimestamp, endTimestamp, density, decimal=False, factor=1000):
step_size = (endTimestamp // factor - startTimestamp // factor)
if density <= 1:
return step_size
if decimal:
return step_size / density
return step_size // (density - 1)