refactor(statistics): consolidate busiest_day and best_day on StatisticsSummary #201

Closed
opened 2026-10-02 14:56:01 +00:00 by gabogg · 2 comments
Owner

Follow-up from #99 and PR #168 review pass 1.

In StatisticsSummary, busiest_day (for week periods) and best_day (for month periods) hold identical NamedDay representations of the day within the period with the highest visitor count.

They were preserved as separate fields for frontend compatibility. This issue tracks consolidating them into a single consistent field name (e.g. busiest_day) with appropriate frontend migration and deprecation handling.

Follow-up from #99 and PR #168 review pass 1. In `StatisticsSummary`, `busiest_day` (for week periods) and `best_day` (for month periods) hold identical `NamedDay` representations of the day within the period with the highest visitor count. They were preserved as separate fields for frontend compatibility. This issue tracks consolidating them into a single consistent field name (e.g. `busiest_day`) with appropriate frontend migration and deprecation handling.
Author
Owner

Back to needs-triage (2026-10-02). PR #168's second review (r21) found an open design point: which name survives (busiest_day or best_day), and how the frontend contract migrates. There is also no acceptance criterion. Settle these, then restore ready-for-agent.

Back to `needs-triage` (2026-10-02). PR #168's second review (r21) found an open design point: which name survives (`busiest_day` or `best_day`), and how the frontend contract migrates. There is also no acceptance criterion. Settle these, then restore `ready-for-agent`.
Author
Owner

This was generated by AI during triage.

Agent Brief

Category: enhancement (refactor)
Summary: Merge busiest_day and best_day into one busiest_day field on StatisticsSummary, labelled "BUSIEST DAY" in both week and month views.

Delivery: fixed inside PR #168, as part of its pass-2 fixes, and closed by it (maintainer, 2026-10-02).

Current behavior:

  • StatisticsSummary has two optional NamedDay fields filled from the same value: the reliable day in the period with the most visitors.
    • Week summaries set busiest_day; month summaries set best_day.
    • Both serializations omit the absent one.
  • The week view shows busiest_day labelled "BUSIEST DAY" / "DÍA DE MÁS AFLUENCIA". The month view shows best_day labelled "BEST DAY" / "MEJOR DÍA".
  • The glossary defines neither term.

Desired behavior:

  • One field, busiest_day: NamedDay | None, filled for both week and month summaries with the same rule: the period's reliable day with the most visitors, never an unreliable (excluded) day and never a Closed Day. best_day is removed, with no alias. Backend and frontend change together, since the only consumer is this repo's frontend.
  • Both views label it "BUSIEST DAY" / "DÍA DE MÁS AFLUENCIA". The month view's KPI reads busiest_day. The bestDay KPI and i18n keys are removed, or renamed to the busiest-day ones.
  • Glossary (CONTEXT.md): add a term Busiest Day, "the reliable day in a period with the most visitors; never an unreliable (excluded) day or a Closed Day", with _Avoid_: best day.
  • docs/api/README.md and the summary serializer's field list describe the single field.

Key interfaces:

  • StatisticsSummary: remove best_day; busiest_day covers week and month.
  • The summary service sets busiest_day for every granularity that has one.
  • Month view KPI mapping: bestDay → busiestDay.

Acceptance criteria:

  • Week and month summaries both serve busiest_day, and no response contains best_day.
  • Existing tests for excluding unreliable and Closed days from the record still pass against busiest_day for both week and month.
  • The month view shows "BUSIEST DAY" / "DÍA DE MÁS AFLUENCIA", and the frontend month tests use busiest_day.
  • No bestDay / "BEST DAY" / "MEJOR DÍA" string remains in the frontend or i18n.
  • The CONTEXT.md term Busiest Day is present, with its Avoid entry.
  • The OpenAPI schema and docs/api/README.md list only busiest_day.

Out of scope:

  • Changing which day counts as the busiest (the reliability and Closed Day rules stay).
  • Adding a busiest day to day or year views where none exists today.
> *This was generated by AI during triage.* ## Agent Brief **Category:** enhancement (refactor) **Summary:** Merge `busiest_day` and `best_day` into one `busiest_day` field on `StatisticsSummary`, labelled "BUSIEST DAY" in both week and month views. **Delivery:** fixed inside **PR #168**, as part of its pass-2 fixes, and closed by it (maintainer, 2026-10-02). **Current behavior:** - `StatisticsSummary` has two optional `NamedDay` fields filled from the same value: the reliable day in the period with the most visitors. - Week summaries set `busiest_day`; month summaries set `best_day`. - Both serializations omit the absent one. - The week view shows `busiest_day` labelled "BUSIEST DAY" / "DÍA DE MÁS AFLUENCIA". The month view shows `best_day` labelled "BEST DAY" / "MEJOR DÍA". - The glossary defines neither term. **Desired behavior:** - **One field, `busiest_day: NamedDay | None`**, filled for both week and month summaries with the same rule: the period's reliable day with the most visitors, never an unreliable (excluded) day and never a Closed Day. `best_day` is removed, with no alias. Backend and frontend change together, since the only consumer is this repo's frontend. - Both views label it **"BUSIEST DAY" / "DÍA DE MÁS AFLUENCIA"**. The month view's KPI reads `busiest_day`. The `bestDay` KPI and i18n keys are removed, or renamed to the busiest-day ones. - **Glossary (CONTEXT.md):** add a term **Busiest Day**, "the reliable day in a period with the most visitors; never an unreliable (excluded) day or a Closed Day", with `_Avoid_: best day`. - `docs/api/README.md` and the summary serializer's field list describe the single field. **Key interfaces:** - `StatisticsSummary`: remove `best_day`; `busiest_day` covers week and month. - The summary service sets `busiest_day` for every granularity that has one. - Month view KPI mapping: `bestDay` → `busiestDay`. **Acceptance criteria:** - [ ] Week and month summaries both serve `busiest_day`, and no response contains `best_day`. - [ ] Existing tests for excluding unreliable and Closed days from the record still pass against `busiest_day` for both week and month. - [ ] The month view shows "BUSIEST DAY" / "DÍA DE MÁS AFLUENCIA", and the frontend month tests use `busiest_day`. - [ ] No `bestDay` / "BEST DAY" / "MEJOR DÍA" string remains in the frontend or i18n. - [ ] The CONTEXT.md term Busiest Day is present, with its _Avoid_ entry. - [ ] The OpenAPI schema and `docs/api/README.md` list only `busiest_day`. **Out of scope:** - Changing which day counts as the busiest (the reliability and Closed Day rules stay). - Adding a busiest day to day or year views where none exists today.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gabogg/hikcentral#201
No description provided.