Skip to content

Commit

Permalink
Cloning fixes in new competition form (#8910)
Browse files Browse the repository at this point in the history
* Add cloning check to frontend to filter out main event

* Compute staff and organizer IDs in a more cloning-friendly way

* Extra requirements are not required as per WCRP
  • Loading branch information
gregorbg authored Feb 13, 2024
1 parent 7b99d90 commit 90fcc72
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
6 changes: 3 additions & 3 deletions WcaOnRails/app/models/competition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2135,9 +2135,9 @@ def to_form_data
"reason" => competitor_limit_reason,
},
"staff" => {
"staffDelegateIds" => staff_delegates.pluck(:id),
"traineeDelegateIds" => trainee_delegates.pluck(:id),
"organizerIds" => organizers.pluck(:id),
"staffDelegateIds" => staff_delegates.to_a.pluck(:id),
"traineeDelegateIds" => trainee_delegates.to_a.pluck(:id),
"organizerIds" => organizers.to_a.pluck(:id),
"contact" => contact,
},
"championships" => championships.map(&:championship_type),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
isAdminView: @competition_admin_view,
isPersisted: @competition.persisted?,
isSeriesPersisted: @competition.competition_series&.persisted? || false,
isCloning: @competition.being_cloned_from.present?,
}) %>
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default function EventRestrictions() {
eventLimitation,
},
},
isCloning,
storedEvents,
} = useStore();

Expand Down Expand Up @@ -63,9 +64,13 @@ export default function EventRestrictions() {
<InputNumber id="perRegistrationLimit" />
</ConditionalSection>
</SubSection>
<Divider />

<InputSelect id="mainEventId" options={mainEventOptions} />
{!isCloning && (
<>
<Divider />
<InputSelect id="mainEventId" options={mainEventOptions} />
</>
)}
</SubSection>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function RegistrationDetails() {
<ConditionalSection showIf={guestsRestricted}>
<InputNumber id="guestsPerRegistration" required={guestsRestricted} />
</ConditionalSection>
<InputMarkdown id="extraRequirements" required />
<InputMarkdown id="extraRequirements" />
<InputBoolean id="forceComment" />
</SubSection>
);
Expand Down
6 changes: 4 additions & 2 deletions WcaOnRails/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,8 @@ en:
per_registration_limit: "Events per registration limit"
main_event_id: "Main event"
remarks: "Remarks"
clone_tabs: "I would like to clone all tabs with additional information as well"
cloning:
clone_tabs: "I would like to clone all tabs with additional information as well"
#context: for a competition
hints:
admin:
Expand Down Expand Up @@ -1614,7 +1615,8 @@ en:
per_registration_limit: "Optionally enforce the total number of events a competitor can register for (commonly used for \"Favorites\" competitions). You should add events before using this field. Registrations with too many events will be blocked. Leave blank if there is no limit."
main_event_id: "The winner of this event will be the winner of the competition."
remarks: "Some additional information you want to pass on to the WCAT. For example, if there is something you are uncertain about, or if there are any special requests for the WCAT. Please fill this out in English!"
clone_tabs: ""
cloning:
clone_tabs: ""
choices:
#context: about guests
guests_enabled:
Expand Down

0 comments on commit 90fcc72

Please sign in to comment.