Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

FinnIckler
Copy link
Member

@FinnIckler FinnIckler commented Feb 5, 2025

Has the Admin schedule where you can open rounds. Will add some tests to this once the db pr is merged

Copy link
Member

@gregorbg gregorbg left a 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"
Copy link
Member

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.

Comment on lines +144 to +149
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
Copy link
Member

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 && ...)?

Copy link
Member Author

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

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