Skip to content

Count every award in Analytics and keep its totals consistent - #3

Merged
Loyale merged 1 commit into
mainfrom
claude/pensive-rubin-9orytb
Oct 16, 2026
Merged

Loyale merged 1 commit into
mainfrom
claude/pensive-rubin-9orytb

Conversation

@Loyale

@Loyale Loyale commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Fixes Analytics math that could show "1 awarded of 13 decided" and $0 Total awarded next to a Funding awarded chart showing millions.

Causes

  • Awards dropped from the counts. Analytics placed applications only by submitted date or sponsor deadline. Awards entered without either (typical for past grants added from the award side) fell out of Submitted, Success rate and the outcomes chart.
  • Chart ignored the filters. Funding awarded summed every award in the database, whatever the funder and role filters said.
  • Tile on a third basis. Total awarded counted only awarded applications already in range, so it could disagree with the chart beside it.
  • No award record on create. Creating an application directly as Awarded made no award record, unlike moving it to Awarded on the Board.

Changes

  • Placement fallback. Applications are placed by submitted date, then deadline, then decision, award notice or start date. A notice on the page lists those placed by a fallback date, or not placed at all, so the dates can be fixed.
  • Consistent totals. Funding awarded follows the funder and role filters, and Total awarded is the sum of that chart.
  • Dashboard. The 5-year success rate counts awards with no decision date by their notice or start date.
  • Create as Awarded. This now creates the award record and opens the award form. It makes budget years only: no setup or reporting tasks, and the award is Closed if the project period is over. For a closed award, the form no longer pre-ticks the reporting schedule.
  • Late status changes. Recording a status late uses a sponsor deadline that has passed as the submitted date, instead of today.
  • Board. The Awarded and Not funded columns show the date they cover, and the toggle reads "Show everything".

No migrations, and no changes to existing records.

Testing

  • Reproduction. A history shaped like the reported page gave the same numbers before the fix: 15 submitted, 1 of 13 decided, $0. After the fix the same data reads 9 of 21, the total matches the chart, and a foundation award no longer appears under NIH.
  • New tests. grants/tests/test_analytics.py adds 12 tests. 10 of them fail on the old code; the other 2 are guards that pass on both.
  • Full suite. 117 tests pass. check --deploy and makemigrations --check are clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SAPwFhRyU83ey74tK1cYbJ


Generated by Claude Code

Analytics placed applications only by submitted date or sponsor deadline, so
awards entered without either (typical for past grants added from the award
side) dropped out of the counts and success rates. The Funding awarded chart
summed every award in the database regardless of the funder and role
filters, and the Total awarded tile used yet another basis, so the page could
show $0 awarded beside a chart of millions.

- Place applications by submitted date, then deadline, then decision, award
  notice or start date. A notice lists those placed by a fallback date, or
  not placed at all, so they can be fixed.
- Funding awarded follows the funder and role filters; Total awarded is the
  sum of that chart.
- The dashboard's 5-year success rate counts awards with no decision date by
  their notice or start date.
- Creating an application as Awarded now creates its award record (budget
  years only, Closed if the project is over, no setup or reporting tasks) and
  opens the award form, which no longer pre-ticks a reporting schedule for a
  closed award.
- Recording a status late uses a sponsor deadline that has passed as the
  submitted date instead of today.
- Board: the Awarded and Not funded columns say which dates they cover, and
  the toggle reads "Show everything".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SAPwFhRyU83ey74tK1cYbJ
@Loyale
Loyale merged commit 6ff2460 into main Oct 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants