pub async fn count_states_for_day(
conn: &mut PgConnection,
day_start: DateTime<Utc>,
day_end: DateTime<Utc>,
) -> ModelResult<Vec<DailyStateCounts>>Expand description
One row per state, whether or not anything is in it: a state missing from a day would read as a gap in the chart rather than as an empty queue.
count is the depth right now, so this has to be called on the day it describes.
entered_count/left_count come from the transitions inside [day_start, day_end), which the
caller passes explicitly: snapshot_date alone would make the day boundary depend on the
database’s timezone.