-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WCA Live Result Admin #2: Opening Rounds #10777
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not much to discuss here, but while we're at it we should probably find a better name for this whole "open" concept.
It worked while WCA Live was separate, because ever special term had to be interpreted with regards to live results entry. Now that we're moving the functionality back into the monolith, "open" suddenly is a bit too generic. Open for what? For registration? For complaints? For editing?
Suggestions:
scoretaking_open
scoretaking_active
live_results_open
data_entry_ongoing
- permutations of the prefixes and suffixes above
round = Round.find(round_id) | ||
|
||
if round.is_open? | ||
flash[:danger] = "Round is already open" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we should be working with flash
messages at this point.
def round_can_be_opened? | ||
return false if is_open | ||
return true if number == 1 | ||
previous_round = Round.joins(:competition_event).find_by(competition_event: { competition_id: competition_event.competition_id, event_id: event.id }, number: number - 1) | ||
previous_round.score_taking_done? | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this just number == 1 || (!is_open && ...)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no. that would always return true for rounds with number == 1
. But these are not openable if they are already opened. it actually used to be this
def round_can_be_opened?
return false if is_open
return !is_open if number == 1
previous_round = Round.joins(:competition_event).find_by(competition_event: { competition_id: competition_event.competition_id, event_id: event.id }, number: number - 1)
previous_round.score_taking_done?
end
but that !is_open
is redundant after the first check
Has the Admin schedule where you can open rounds. Will add some tests to this once the db pr is merged