Description:
The finalize_round endpoint at admin_endpoints.py sets rnd.status = FINALIZED_STATUS directly on the ORM object instead of calling the proper DAO methods (finalize_rating_round or finalize_ranking_round). This means:
close_date is never set on the round
- No audit log entry is created
- For ranking rounds, no RoundResultsSummary is persisted
- For rating rounds, no final_threshold is stored in config
Steps to Reproduce:
- Create a campaign, add a round, activate it, and complete all voting
- Finalize the round via the endpoint
- Check the round's
close_date in the database, it is NULL
- Check the audit log, no
finalize_round entry exists
Expected Behavior
Finalizing a round should perform all required finalization actions, including:
- Set
close_date to the current timestamp
- Create an audit log entry for the finalization action
- For ranking rounds: create a
RoundResultsSummary
- For rating rounds: store the
final_threshold in the configuration
Actual Behavior
Only the status field is changed. All other finalization side-effects are skipped.
Additional Context
Compare the broken endpoint code:
with the proper DAO methods at rdb.py (finalize_rating_round and finalize_ranking_round) that handle close_date, logging, threshold config, and result summaries.