Skip to content

Commit

Permalink
Adding lottery questions
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbyt3r committed Aug 11, 2024
1 parent c4a1449 commit 2321ba1
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 71 deletions.
104 changes: 40 additions & 64 deletions uber.ini
Original file line number Diff line number Diff line change
@@ -1,76 +1,52 @@
[hotel_lottery]
[[gaylord]]
[[hotels]]
[[[gaylord]]]
name = "Gaylord National Harbor"
description = "The drive can't be that bad, can it?"
[[[Double Queen]]]
name = "Double Queen"
description = "Two beds in a box"
price = 10000
capacity = 4
[[[King]]]
name = "King"
description = "One bed in a box"
price = 10000
capacity = 4
[[[Suite]]]
name = "Suite"
description = "Baller over here"
price = 20000
capacity = 8

[[roof]]
[[[roof]]]
name = "Rooftop Room"
description = "Camping out on the roof of the Donald E. Stephens Convention Center"
[[[Double Queen]]]
name = "Double Queen"
description = "Two beds in a box"
price = 10000
capacity = 4
[[[King]]]
name = "King"
description = "One bed in a box"
price = 10000
capacity = 4
[[[Suite]]]
name = "Suite"
description = "Baller over here"
price = 20000
capacity = 8

[[cardboard]]
[[[cardboard]]]
name = "Cardboard Box"
description = "Literally a big box. Do you fits?"
[[[Double Queen]]]
name = "Double Queen"
description = "Two beds in a box"
price = 10000
capacity = 4
[[[King]]]
name = "King"
description = "One bed in a box"
price = 10000
capacity = 4
[[[Suite]]]
name = "Suite"
description = "Baller over here"
price = 20000
capacity = 8

[[mark_center]]
[[[mark_center]]]
name = "Hilton Mark Center"
description = "The tall one"
[[[Double Queen]]]
name = "Double Queen"
description = "Two beds in a box"
price = 10000
capacity = 4
[[[King]]]
name = "King"
description = "One bed in a box"
price = 10000
capacity = 4
[[[Suite]]]
name = "Suite"
description = "Baller over here"
price = 20000
capacity = 8

[[room_types]]
[[[king]]]
name = "King Room"
description = "One really big bed"

[[[double]]]
name = "Double Room"
description = "Two beds"

[[suite_room_types]]
[[[super]]]
name = "Super Suite"
description = "This is the one everyone wants"

[[[meh]]]
name = "Meh Suite"
description = "I guess"

[[[overpriced]]]
name = "Overpriced Suite"
description = "This one is just crazy expensive. Otherwise a normal room."

[[hotel_priorities]]
[[[hotel]]]
name = "Hotel"
description = "Which hotel matters to me."

[[[dates]]]
name = "Dates"
description = "Check-In and Check-Out dates matter to me."

[[[room]]]
name = "Room Type"
description = "The type of room I get matters."
10 changes: 6 additions & 4 deletions uber/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1555,10 +1555,12 @@ def _unrepr(d):
c.SAME_NUMBER_REPEATED = r'^(\d)\1+$'

c.HOTEL_LOTTERY = _config.get('hotel_lottery', {})
c.HOTEL_LOTTERY_HOTEL_OPTS = []
for name, item in c.HOTEL_LOTTERY.items():
if isinstance(item, dict):
c.HOTEL_LOTTERY_HOTEL_OPTS.append((name, item))
for key in ["hotels", "room_types", "suite_room_types", "hotel_priorities"]:
opts = []
for name, item in c.HOTEL_LOTTERY.get(key, {}).items():
if isinstance(item, dict):
opts.append((name, item))
setattr(c, f"HOTEL_LOTTERY_{key.upper()}_OPTS", opts)

# Allows 0-9, a-z, A-Z, and a handful of punctuation characters
c.VALID_BADGE_PRINTED_CHARS = r'[a-zA-Z0-9!"#$%&\'()*+,\-\./:;<=>?@\[\\\]^_`\{|\}~ "]'
Expand Down
14 changes: 14 additions & 0 deletions uber/configspec.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,20 @@ full = string(default="All Info")
[[food_restriction]]
vegan = string(default="Vegan")

[[hotel_room_type]]
room_double = string(default="Double Room")
room_king = string(default="King Room")

[[suite_room_type]]
suite_big = string(default="Big Suite")
suite_medium = string(default="Medium Suite")
suite_tiny = string(default="Tiny Suite")

[[hotel_priorities]]
hotel_room_type = string(default="Hotel Room Type")
hotel_selection = string(default="Hotel Selection")
hotel_dates = string(default="Check-In and Check-Out Dates")

[[sandwich]]

[[dealer_status]]
Expand Down
20 changes: 18 additions & 2 deletions uber/forms/attendee.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,24 @@ def valid_cellphone(form, field):


class LotteryApplication(MagForm):
hotel_preference = StringField('Hotel Preference', widget=Ranking(c.HOTEL_LOTTERY_HOTEL_OPTS, id="hotel_preference"),
validators=[validators.Regexp(r"^roof.*$", message="You didn't select the roof as your most preferred hotel. What, are you too good for the great outdoors?")])
wants_room = BooleanField('I would like to enter the hotel room lottery.', default=False)
earliest_room_checkin_date = DateField('Earliest acceptable Check-In Date', validators=[validators.DataRequired("Please enter your earliest check-in date.")])
latest_room_checkin_date = DateField('Latest acceptable Check-In Date', validators=[validators.DataRequired("Please enter your latest check-in date.")])
earliest_room_checkout_date = DateField('Earliest acceptable Check-Out Date', validators=[validators.DataRequired("Please enter your earliest check-out date.")])
latest_room_checkout_date = DateField('Latest acceptable Check-Out Date', validators=[validators.DataRequired("Please enter your latest check-out date.")])
hotel_preference = StringField('Hotel Preference', widget=Ranking(c.HOTEL_LOTTERY_HOTELS_OPTS, id="hotel_preference"))
room_type_preference = StringField('Room Type Preference', widget=Ranking(c.HOTEL_LOTTERY_ROOM_TYPES_OPTS, id="room_type_preference"))
selection_priorities = StringField('Room Priorities', widget=Ranking(c.HOTEL_LOTTERY_HOTEL_PRIORITIES_OPTS, id="selection_priorities"))
accessibility_contact = BooleanField('Please contact me in regards to an accessibility requirement.', default=False)

wants_suite = BooleanField('I would like to enter the suite lottery.', default=False)
earliest_suite_checkin_date = DateField('Earliest acceptable Check-In Date', validators=[validators.DataRequired("Please enter your earliest check-in date.")])
latest_suite_checkin_date = DateField('Latest acceptable Check-In Date', validators=[validators.DataRequired("Please enter your latest check-in date.")])
earliest_suite_checkout_date = DateField('Earliest acceptable Check-Out Date', validators=[validators.DataRequired("Please enter your earliest check-out date.")])
latest_suite_checkout_date = DateField('Latest acceptable Check-Out Date', validators=[validators.DataRequired("Please enter your latest check-out date.")])
suite_type_preference = StringField('Hotel Preference', widget=Ranking(c.HOTEL_LOTTERY_SUITE_ROOM_TYPES_OPTS, id="suite_type_preference"))

terms_accepted = BooleanField('I accept the terms of service of the hotel lottery.', default=False)

class PersonalInfo(AddressForm, MagForm):
field_validation, new_or_changed_validation = CustomValidation(), CustomValidation()
Expand Down
5 changes: 4 additions & 1 deletion uber/models/hotel.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,7 @@ class RoomAssignment(MagModel):


class LotteryApplication(MagModel):
hotel_preference = Column(MultiChoice(c.HOTEL_LOTTERY_HOTEL_OPTS))
hotel_preference = Column(MultiChoice(c.HOTEL_LOTTERY_HOTELS_OPTS))
room_type_preference = Column(MultiChoice(c.HOTEL_LOTTERY_ROOM_TYPES_OPTS))
selection_priorities = Column(MultiChoice(c.HOTEL_LOTTERY_HOTEL_PRIORITIES_OPTS))
suite_type_preference = Column(MultiChoice(c.HOTEL_LOTTERY_SUITE_ROOM_TYPES_OPTS))
3 changes: 3 additions & 0 deletions uber/templates/hotel_lottery/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
{{ form_macros.form_validation('hotel-lottery-form', 'validate_hotel_lottery') }}
<form novalidate method="POST" id="hotel-lottery-form" action="form">
{{ form_macros.form_input(lottery_application.hotel_preference) }}
{{ form_macros.form_input(lottery_application.room_type_preference) }}
{{ form_macros.form_input(lottery_application.selection_priorities) }}
{{ form_macros.form_input(lottery_application.suite_type_preference) }}
{{ csrf_token() }}
<button type="submit" class="btn btn-primary" value="Upload">Save</button>
</form>
Expand Down

0 comments on commit 2321ba1

Please sign in to comment.