.vbw-planning/milestones/ui-fixes-and-smart-scraping/phases/03-dashboard-pagination/.context-lead.md
Not available
Not available
No matching requirements found
None
Codebase mapping exists in .vbw-planning/codebase/. Key files:
ARCHITECTURE.mdCONCERNS.mdPATTERNS.mdDEPENDENCIES.mdSTRUCTURE.mdCONVENTIONS.mdTESTING.mdSTACK.mdRead ARCHITECTURE.md, CONCERNS.md, and STRUCTURE.md first to bootstrap codebase understanding.
UpcomingFetchSchedule (127 lines) loads ALL active sources into memory, groups by fetch window in RubyDashboardController#index calls Dashboard::Queries which caches results per-request_fetch_schedule.html.erb partial with grouped dataPagination::Paginator (91 lines) at lib/source_monitor/pagination/paginator.rbrecords, page, per_page, has_next_page, has_previous_page(page-1)*per_page + 1 records to detect next pagetotal_count and total_pages for jump-to-pagePaginator.new(scope: @q.result, page: params[:page], per_page: params[:per_page])source_monitor_sources_table Turbo FrameStatsQuery computes: total sources, active sources, failed sources, total items, fetches todaySource model has health_status column with values: healthy, warning, declining, criticalSource.active scope exists (where active: true)health_status is a string column — can group by itnext_fetch_at is a datetime column — can use range queries for schedule bucketsturbo_frame_tag "source_monitor_sources_table"Paginator with optional total_count / total_pages — backward compatibleSource.active.where(next_fetch_at: now..now+30.minutes) for each windowSource.active.group(:health_status).count — single SQL queryCOUNT(*) adds a second query per paginated section. For 5 schedule sections + 1 sources index = 6 count queries. Mitigate: count query is cheap on indexed columns.schedule_0_30_page=2).include_total: true flag to compute total pages. Keep backward compatible.group(:health_status).count to StatsQuery.