Dashboard → Applications by month: months labelled \"2026-09\", and months with nothing sent left out #397

Closed
opened 2026-10-01 10:46:24 +00:00 by tiagoagueda · 0 comments
Owner

Found on 2026-09-29 in a read-only review of postulo at 95348908d, reading how the insights are built and drawn.

Checked again on 2026-10-01 against main at 0a5cad587: still present.

The widget says it exists "so a quiet stretch is visible", but it lists only the months in which something was sent, so a quiet month is simply missing. Its labels are ISO strings (2026-09) made with strftime, not month names in the reader's language.

  • Where: applications/analytics.py:541-551 (build): TruncMonth("applied_at") grouped by month, then (row["month"].strftime("%Y-%m"), row["count"]) for row in per_month if row["month"]; templates/widgets/by_month.html:6-9 prints {{ month }} as it comes; the blurb is at applications/widgets.py:291.
  • What happens: five applications in January, none in February and three in March show as two rows, "2026-01 5" and "2026-03 3". The empty February, the one thing the widget is for, is not there, and a French reader sees "2026-01" rather than "janvier 2026".
  • Why it matters: the widget cannot do what its description promises, and it is one of the few places on the dashboard where dates bypass YEAR_MONTH_FORMAT. The template lint from #225 checks |date formats and cannot see a date that arrives as a string. No test mentions by_month.
  • Fix: fill every month from the first one with an application to the current month, with zero where nothing was sent; keep the months as date objects in Insights.by_month and print them with {{ month|date:"YEAR_MONTH_FORMAT" }}.

Related to #225 (closed), which replaced fixed date formats in templates but not this one built in Python.

Done when

  • A test in tests/test_insights.py creates applications in January and March and asserts by_month has three entries with February at zero, each a date; and renders the widget under fr and asserts it contains "février 2026".
Found on 2026-09-29 in a read-only review of postulo at 95348908d, reading how the insights are built and drawn. Checked again on 2026-10-01 against `main` at `0a5cad587`: still present. The widget says it exists "so a quiet stretch is visible", but it lists only the months in which something was sent, so a quiet month is simply missing. Its labels are ISO strings (`2026-09`) made with `strftime`, not month names in the reader's language. - **Where:** `applications/analytics.py:541-551` (`build`): `TruncMonth("applied_at")` grouped by month, then `(row["month"].strftime("%Y-%m"), row["count"]) for row in per_month if row["month"]`; `templates/widgets/by_month.html:6-9` prints `{{ month }}` as it comes; the blurb is at `applications/widgets.py:291`. - **What happens:** five applications in January, none in February and three in March show as two rows, "2026-01 5" and "2026-03 3". The empty February, the one thing the widget is for, is not there, and a French reader sees "2026-01" rather than "janvier 2026". - **Why it matters:** the widget cannot do what its description promises, and it is one of the few places on the dashboard where dates bypass `YEAR_MONTH_FORMAT`. The template lint from #225 checks `|date` formats and cannot see a date that arrives as a string. No test mentions `by_month`. - **Fix:** fill every month from the first one with an application to the current month, with zero where nothing was sent; keep the months as `date` objects in `Insights.by_month` and print them with `{{ month|date:"YEAR_MONTH_FORMAT" }}`. Related to #225 (closed), which replaced fixed date formats in templates but not this one built in Python. ## Done when - A test in `tests/test_insights.py` creates applications in January and March and asserts `by_month` has three entries with February at zero, each a `date`; and renders the widget under `fr` and asserts it contains "février 2026".
tiagoagueda added this to the 0.6.0 milestone 2026-10-01 10:46:24 +00:00
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
Postulo/postulo#397
No description provided.