MishkaDocument.Resources.Helpers.DayMarks (Mishka Document v0.0.1)

Copy Markdown View Source

Ash preparation that tells each event-log row whether it opens a new day in the timeline, and — when it does — how many events that whole day holds. The day heading MishkaCmsCoreWeb.Templates.ActivityTimeline draws is built from both.

A LiveView stream never hands a row its predecessor, so the marks are decided here, where the page is still an ordered list, and carried on each record's metadata (:first_of_day?, :day_count).

Both figures are counted through the very same query the page read — the tenant scope of MishkaDocument.Resources.Helpers.TenantSiteFilter and whatever filters are active — so a heading can never disagree with the rows under it. They count the whole day rather than the loaded window: the log pages with load_more, and a heading counting only the loaded rows would keep climbing as you scroll.

Summary

Functions

init(opts)

Callback implementation for Ash.Resource.Preparation.init/1.

supports(opts)

Callback implementation for Ash.Resource.Preparation.supports/1.

temporal_safe?(opts)

Callback implementation for Ash.Resource.Preparation.temporal_safe?/1.