diff --git a/WcaOnRails/app/javascript/edit-events/index.jsx b/WcaOnRails/app/javascript/edit-events/index.jsx index 09ca876b6a..67811ea13d 100644 --- a/WcaOnRails/app/javascript/edit-events/index.jsx +++ b/WcaOnRails/app/javascript/edit-events/index.jsx @@ -13,9 +13,17 @@ export function rootRender() { } function normalizeWcifEvents(wcifEvents) { - return events.official.map(event => { - return _.find(wcifEvents, { id: event.id }) || { id: event.id, rounds: null }; + // Since we want to support deprecated events and be able to edit their rounds, + // we want to show deprecated events if they exist in the WCIF, but not if they + // don't. + // Therefore we first build the list of events from the official one, updating + // it with WCIF data if any. + // And then we add all events that are still in the WCIF (which means they are + // not official anymore). + let ret = events.official.map(event => { + return _.remove(wcifEvents, { id: event.id })[0] || { id: event.id, rounds: null }; }); + return ret.concat(wcifEvents); } wca.initializeEventsForm = (competitionId, canAddAndRemoveEvents, wcifEvents) => { diff --git a/WcaOnRails/app/views/competitions/edit_events.html.erb b/WcaOnRails/app/views/competitions/edit_events.html.erb index e2ef38d184..0924a80774 100644 --- a/WcaOnRails/app/views/competitions/edit_events.html.erb +++ b/WcaOnRails/app/views/competitions/edit_events.html.erb @@ -2,18 +2,14 @@ <%= javascript_pack_tag 'edit_events' %> <%= render layout: 'nav' do %> - <% if @competition.events.deprecated.count > 0 %> - <%= t('competitions.competition_form.deprecated_events') %> - <% else %> -
- - <% end %> +
+ <% end %> diff --git a/WcaOnRails/config/locales/en.yml b/WcaOnRails/config/locales/en.yml index 277e6ea42b..f3899e21ab 100644 --- a/WcaOnRails/config/locales/en.yml +++ b/WcaOnRails/config/locales/en.yml @@ -1298,7 +1298,6 @@ en: venue_details_html: "Details about the venue (e.g., On the first floor far in the back, follow the signs). %{md}" contact_html: "Optional contact information. If you do not fill this in, organizer emails will be shown to the public. %{md}. Example: [Text to display](mailto:some@email.com)" events: "Events" - deprecated_events: "This competition has events that are no longer official, we do not support editing them." public_and_locked_html: "This competition is publicly visible and locked for editing. If you need to make a change, please reply to the email thread where the competition was confirmed." confirmed_but_not_visible_html: "You've confirmed this competition, but it is not yet visible to the public. Wait for the %{contact} to make it visible." is_visible: "This competition is publicly visible, any changes you make will show up to the public!" diff --git a/WcaOnRails/db/migrate/20200125180554_update_feet_rank.rb b/WcaOnRails/db/migrate/20200125180554_update_feet_rank.rb new file mode 100644 index 0000000000..f3bc86d3e8 --- /dev/null +++ b/WcaOnRails/db/migrate/20200125180554_update_feet_rank.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class UpdateFeetRank < ActiveRecord::Migration[5.2] + def change + # This change goes along updating the feet's rank in the seeds file. + Event.delete_all + load "#{Rails.root}/db/seeds/events.seeds.rb" + end +end diff --git a/WcaOnRails/db/seeds/events.seeds.rb b/WcaOnRails/db/seeds/events.seeds.rb index fceb188c07..26f90b840c 100644 --- a/WcaOnRails/db/seeds/events.seeds.rb +++ b/WcaOnRails/db/seeds/events.seeds.rb @@ -10,7 +10,6 @@ ('333bf', '3x3x3 Blindfolded', 70, 'time', '3x3x3 Blindfolded'), ('333fm', '3x3x3 Fewest Moves', 80, 'number', '3x3x3 Fewest Moves'), ('333oh', '3x3x3 One-Handed', 90, 'time', '3x3x3 One-Handed'), -('333ft', '3x3x3 With Feet', 100, 'time', '3x3x3 With Feet'), ('clock', 'Clock', 110, 'time', 'Clock'), ('minx', 'Megaminx', 120, 'time', 'Megaminx'), ('pyram', 'Pyraminx', 130, 'time', 'Pyraminx'), @@ -19,6 +18,7 @@ ('444bf', '4x4x4 Blindfolded', 160, 'time', '4x4x4 Blindfolded'), ('555bf', '5x5x5 Blindfolded', 170, 'time', '5x5x5 Blindfolded'), ('333mbf', '3x3x3 Multi-Blind', 180, 'multi', '3x3x3 Multi-Blind'), +('333ft', '3x3x3 With Feet', 996, 'time', '3x3x3 With Feet'), ('magic', 'Magic', 997, 'time', 'Magic'), ('mmagic', 'Master Magic', 998, 'time', 'Master Magic'), ('333mbo', '3x3x3 Multi-Blind Old Style', 999, 'multi', '3x3x3 Multi-Blind Old Style');" diff --git a/WcaOnRails/db/structure.sql b/WcaOnRails/db/structure.sql index c8cb563651..d866be33a8 100644 --- a/WcaOnRails/db/structure.sql +++ b/WcaOnRails/db/structure.sql @@ -1625,4 +1625,5 @@ INSERT INTO `schema_migrations` (version) VALUES ('20190916133253'), ('20191005203556'), ('20191013211511'), -('20191107212356'); +('20191107212356'), +('20200125180554');