Voile.Dashboard.Stats (Voile v0.1.48)

Copy Markdown View Source

Context for dashboard statistics.

Lifts the GLAM / catalog / member statistics queries that previously lived as private functions inside VoileWeb.Dashboard.Glam.Index and VoileWeb.DashboardLive so the new dashboard home (Phase 2 of the redesign) can feed the GLAM strip without duplicating the logic.

All queries honor node scoping: when the given user has a node_id, counts are restricted to that node; super admins (with node_id == nil) see everything.

Summary

Functions

Computes catalog statistics scoped to the user's node.

Computes GLAM statistics scoped to the given user's node.

Computes member statistics scoped to the user's node.

Returns the most recently created collections scoped to the user's node, preloading the associations the dashboard rows need to render.

Functions

get_catalog_stats(user)

Computes catalog statistics scoped to the user's node.

get_glam_statistics(user)

Computes GLAM statistics scoped to the given user's node.

Returns a map with both the nested per-type breakdown (consumed by the legacy glam_navigation_cards component) and flat *_count keys (consumed by the v2 voile_glam_strip). *_delta keys are present but always 0 — trend data is tracked separately and can be wired in a later phase.

get_member_stats(user)

Computes member statistics scoped to the user's node.

list_recent_collections(limit, user)

Returns the most recently created collections scoped to the user's node, preloading the associations the dashboard rows need to render.