Skip to content

Add lifecycle_state to Round model#14154

Open
FinnIckler wants to merge 13 commits into
thewca:mainfrom
FinnIckler:round-state-hoist
Open

Add lifecycle_state to Round model#14154
FinnIckler wants to merge 13 commits into
thewca:mainfrom
FinnIckler:round-state-hoist

Conversation

@FinnIckler
Copy link
Copy Markdown
Member

Does not remove locked_by_id yet because that is required by the backfilling. The migration is also crazy inefficient right now as 99.99% of rounds will be just "done" as a state (it actually has not finished running on my laptop yet).

Maybe we just say every round with results submitted is done and otherwise pending? Should cover our bases if every competition using ILR is either done or submitted right now

Comment thread app/controllers/api/v1/live/live_controller.rb
Comment thread app/controllers/api/v1/live/live_controller.rb
Comment thread app/models/round.rb Outdated

has_many :sibling_rounds, through: :competition_event, source: :rounds

enum :lifecycle_state, { pending: "pending", open: "open", locked: "locked", done: "done" }, prefix: true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the precise difference between locked and done?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your previous approach had ready, this new approach doesn't... What is the difference in design?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ready is a dynamic property, so I had to move it out of the lifecycle state. Otherwise we would need to update the lifecycle state of the next round in the update_live_results_job, only if adding that live result would make the next round ready and we wanted to get rid of this next round checking shenanigans

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

locked = next round is open, results can still be edited. done = results are posted, results can no longer be edited

Comment thread app/models/round.rb Outdated
Comment thread app/models/round.rb Outdated
Comment thread app/models/round.rb
Comment thread db/migrate/20260427120000_add_lifecycle_state_to_rounds.rb Outdated
Comment thread db/migrate/20260427120000_add_lifecycle_state_to_rounds.rb
Comment thread app/models/round.rb Outdated
Comment thread next-frontend/openapi/schemas/live/AdminRounds/BaseAdminRound.yaml
FinnIckler and others added 6 commits April 28, 2026 10:02
Co-authored-by: Gregor Billing <gregor.billing.dev@gmail.com>
Co-authored-by: Gregor Billing <gregor.billing.dev@gmail.com>
@FinnIckler
Copy link
Copy Markdown
Member Author

Does my explanation and the test help why ready is needed?

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