Skip to content

fix(admin): allow campaign finalization after ranking round is finali… - #672

Draft
SSpirate11 wants to merge 1 commit into
hatnote:masterfrom
SSpirate11:fix/finalize-ranking-round-campaign-644
Draft

SSpirate11 wants to merge 1 commit into
hatnote:masterfrom
SSpirate11:fix/finalize-ranking-round-campaign-644

Conversation

@SSpirate11

Copy link
Copy Markdown
Contributor

Fixes #644

Fixes an issue where finalizing the last (ranking) round using the round's own "Finalize round" button makes the campaign impossible to close, locking coordinators out of the campaign report. Finalizing the ranking round directly now properly completes the round and generates the summary, and closing the campaign afterwards succeeds cleanly.

Changes done :

Added finalize_round() to properly finalize ranking and non-ranking rounds.
Idempotent summary (rdb.py): updated finalize_ranking_round() to update existing results summaries instead of creating duplicates.
Campaign endpoint (admin_endpoints.py): allowed finalize_campaign() to complete when the ranking round is already finalized.
Round endpoint (admin_endpoints.py): hooked finalize_round() into coord_dao.finalize_round() for complete round finalization.
Test coverage (test_web_basic.py): added integration tests for finalizing the ranking round before closing the campaign.

Working : When a coordinator clicks "Finalize round" on the ranking round, the round is marked finalized, its close date is recorded, and the campaign results summary is generated. When they subsequently click "Close campaign", the endpoint recognizes the already finalized ranking round, closes the campaign, and makes the campaign report immediately available (200 OK). Re-finalizing an already closed campaign returns a clean 400 Bad Request ("campaign is already finalized").

@lgelauff

Copy link
Copy Markdown
Collaborator

Thank you for this. On #462 we agreed that the round's Finalize button only closes the round, with no results summary there. That part goes in through #683 (from #491).

The rest of your approach is in #684, and you're a co-author of its commit:

The one difference: the summary is built when the campaign is finalized, not when the round is. Closing this one in favour of #684.

Written by Claude (Claude Code) on behalf of @lgelauff.

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.

Finalizing the ranking round with its own button makes the campaign impossible to finalize

2 participants