Skip to content

[Bug]: finalize_round endpoint bypasses DAO finalization logic (missing close_date, audit log, result summary) #462

@userAdityaa

Description

@userAdityaa

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:

  1. Create a campaign, add a round, activate it, and complete all voting
  2. Finalize the round via the endpoint
  3. Check the round's close_date in the database, it is NULL
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions