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

Extended round format validation #5396

Open
viroulep opened this issue Apr 27, 2020 · 0 comments
Open

Extended round format validation #5396

viroulep opened this issue Apr 27, 2020 · 0 comments
Labels
TEAM: wrt issues related to WRT

Comments

@viroulep
Copy link
Contributor

Some past rounds are currently invalid in the database because the preferred_formats has changed over time (from mo3 - aka m - to ao5 - aka a).
This has some annoying consequences, for instance when editing a past competition's events and rounds information: if one of the round is invalid because of this, any change (even if unrelated) can't go through because the overall validation fails.

Since editing past competitions doesn't happen every day, and we can also workaround it, this is not a super urgent fix; but on the long term it would be nice to have a mapping event_id,date => list_of_allowed_formats.

It's not that straightforward to implement cleanly.
One alternative would be to have tables with event_id,format,start_date,end_date and do the math, but it seems overly complicated for something which almost never changes.
An easier approach could be to just hardcode the format id allowed in our event model, ie something like:

# in the Event model
def preferred_formats(at_date: Time.now)
  # some big switch case based on date 
end

The question with that approach is: how often in our codebase do we rely on the preferred_formats table, and can't we simply get rid of it?
(I haven't taken a look at that)

When we have a way to check the format based on an event and a date, we can just update the round validation to pass down the competition's date it belongs to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TEAM: wrt issues related to WRT
Projects
Status: No status
Status: No status
Development

No branches or pull requests

1 participant