-
Notifications
You must be signed in to change notification settings - Fork 176
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
Add more info to the competition API #8409
Conversation
COMPETITION_INFO_SERIALIZE_OPTIONS = { | ||
only: %w[id name website start_date registration_open registration_close announced_at cancelled_at end_date competitor_limit extra_registration_requirements enable_donations refund_policy_limit_date event_change_deadline_date waiting_list_deadline_date on_the_spot_registration on_the_spot_entry_fee_lowest_denomination qualification_results event_restrictions base_entry_fee_lowest_denomination currency_code allow_registration_edits allow_registration_self_delete_after_acceptance allow_registration_without_qualification refund_policy_percent use_wca_registration guests_per_registration_limit venue contact force_comment_in_registration use_wca_registration external_registration_page guests_entry_fee_lowest_denomination guest_entry_status information], | ||
methods: %w[url website short_name city venue_address venue_details latitude_degrees longitude_degrees country_iso2 event_ids registration_opened? main_event_id number_of_bookmarks using_stripe_payments? uses_qualification? uses_cutoff? events_with_rounds schedule_wcif], | ||
include: %w[delegates organizers tabs], | ||
}.freeze |
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.
This slightly reminds me of thewca/wcif#17.
What information is there in this big array that you need, but that you cannot currently get through WCIF?
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 changed it to only have the new fields that I need, but as mentioned above, most of them are not in the wcif
No, as long as it's backwards-compatible a new route is not necessary |
These are all the fields I added, most of them are not available in wcif |
The Is there any chance your new frontend can fetch the WCIF and the "internal competition format" separately and combine the two as needed? |
That is no problem, that would also mean I don't need events_with_rounds. |
Any idea why the tests fail? |
I just tested it in the ruby console and DEFAULT_SERIALIZE_OPTIONS.merge(COMPETITION_INFO_SERIALIZE_OPTIONS) is just COMPETITION_INFO_SERIALIZE_OPTIONS, so the code in serializable_hash actually never worked (at least for this use case) |
looking at the documentation for merge it makes sense:
I added a block to see if that is the way |
I solved it using the https://github.com/danielsdeleo/deep_merge third-party library. For context:
|
and tests pass! We should be able to merge it then, which is going to enable me to change the code on wca-registrations accordingly |
To Render the WCA-Registrations Frontend we need some more info as part of the competition API. I also added a
stale?
check because this route will be used much more heavily on the Frontend and we don't want to recompute it if not needed.I chose to keep it under it's current route as this change is compatible with the current response, but I can add a new path if it makes more sense.