Skip to content

Commit

Permalink
Force the user to pick a timezone.
Browse files Browse the repository at this point in the history
Right now, we pick a default for them, which is probably fine in
countries with one timezone, but does *not* work well for countries with
multiple timezones. See
#4487 for more
information.
  • Loading branch information
jfly committed Aug 25, 2019
1 parent 6cd07e4 commit 97bfdf8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions WcaOnRails/app/javascript/edit-schedule/EditSchedule.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ function addVenueToSchedule(competitionInfo) {
countryIso2: competitionInfo.countryIso2,
latitudeMicrodegrees: competitionInfo.lat,
longitudeMicrodegrees: competitionInfo.lng,
// There is at least one for all countries, select the first
timezone: Object.values(competitionInfo.countryZones)[0],
timezone: null,
rooms: [],
});
}
3 changes: 2 additions & 1 deletion WcaOnRails/app/javascript/edit-schedule/EditVenue/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,11 @@ const TimezoneInput = ({timezone, selectKeys, actionHandler}) => (
</Col>
<Col xs={9}>
<select
className="form-control"
className="venue-timezone-input form-control"
value={timezone}
onChange={e => actionHandler(e, "timezone")}
>
<option value=""></option>
{selectKeys.map(key => {
return (
<option key={key} value={timezoneData[key] || key}>{key}</option>
Expand Down
3 changes: 3 additions & 0 deletions WcaOnRails/spec/features/competition_manage_schedule_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
fill_in with: "Venue", class: "venue-name-input"
click_on "Add room"
fill_in with: "Youpitralala", class: "room-name-input"
within('.venue-timezone-input') do
select "Pacific Time (US & Canada)"
end
save
expect(competition.competition_venues.map(&:name)).to match_array %w(Venue)
expect(competition.competition_venues.flat_map(&:venue_rooms).map(&:name)).to match_array %w(Youpitralala)
Expand Down

0 comments on commit 97bfdf8

Please sign in to comment.