Skip to content

Commit

Permalink
fixes #1682
Browse files Browse the repository at this point in the history
  • Loading branch information
EliAndrewC committed Feb 14, 2016
1 parent f572b8a commit eaabf4b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
2 changes: 2 additions & 0 deletions development-defaults.ini
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ printed_badge_deadline = "2016-01-04"

room_deadline = "2015-11-30"

badge_price_waived = "2016-02-21 12"


[badge_prices]

Expand Down
6 changes: 6 additions & 0 deletions uber/configspec.ini
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,12 @@ prereg_takedown = string(default="2016-01-18")
# able to edit them after this happens.
uber_takedown = string(default="2016-01-21")

# On the last day of an event, we usually let people in for free when it's so close to
# the end of the day that it would be silly to charge someone for e.g. an hour or two.
# Badges registered through the at-the-door registration form after this time will
# automatically be marked as paid.
badge_price_waived = string(default="")

epoch = string(default="2016-01-23 08")
eschaton = string(default="2016-01-26 18")

Expand Down
9 changes: 6 additions & 3 deletions uber/site_sections/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ def register(self, session, message='', **params):
attendee = session.attendee(params, restricted=True, ignore_csrf=True)
if 'first_name' in params:
message = check(attendee)
if not attendee.payment_method:
if not attendee.payment_method and (not c.BADGE_PRICE_WAIVED or c.BEFORE_BADGE_PRICE_WAIVED):
message = 'Please select a payment type'
elif attendee.payment_method == c.MANUAL and not re.match(c.EMAIL_RE, attendee.email):
message = 'Email address is required to pay with a credit card at our registration desk'
Expand All @@ -507,7 +507,10 @@ def register(self, session, message='', **params):
session.add(attendee)
session.commit()
message = 'Thanks! Please queue in the {} line and have your photo ID and {} ready.'
if attendee.payment_method == c.STRIPE:
if c.AFTER_BADGE_PRICE_WAIVED:
message = "Since it's so close to the end of the event, your badge is free! Please proceed to the preregistration line to pick it up."
attendee.paid = c.NEED_NOT_PAY
elif attendee.payment_method == c.STRIPE:
raise HTTPRedirect('pay?id={}', attendee.id)
elif attendee.payment_method == c.GROUP:
message = 'Please proceed to the preregistration line to pick up your badge.'
Expand Down Expand Up @@ -564,7 +567,7 @@ def new(self, session, show_all='', message='', checked_in=''):
if show_all:
restrict_to = [Attendee.paid == c.NOT_PAID, Attendee.placeholder == False]
else:
restrict_to = [Attendee.registered > datetime.now(UTC) - timedelta(minutes=90)]
restrict_to = [Attendee.paid != c.NEED_NOT_PAY, Attendee.registered > datetime.now(UTC) - timedelta(minutes=90)]

return {
'message': message,
Expand Down
19 changes: 12 additions & 7 deletions uber/templates/registration/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
window.setTimeout(toastr.clear, 10000);

var maybeBold = function() {
if ($.val('payment_method') === {{ c.MANUAL }}) {
$('#email').css('font-weight', 'bold');
var $emailLabel = $('#email').parents('.form-group').find('label');
if (!$.field('payment_method') || $.val('payment_method') === {{ c.MANUAL }}) {
$emailLabel.addClass('optional-field');
} else {
$('#email').css('font-weight', 'normal');
$emailLabel.removeClass('optional-field');
}
};
$(maybeBold);
Expand Down Expand Up @@ -40,10 +41,14 @@
<div class="form-group">
<label class="col-sm-2 control-label">Payment Method</label>
<div class="col-sm-6">
<select name="payment_method" class="form-control" onChange="maybeBold()">
<option value="">Select a payment option</option>
{% options c.DOOR_PAYMENT_METHOD_OPTS attendee.payment_method %}
</select>
{% if c.AFTER_BADGE_PRICE_WAIVED %}
<div style="margin-top:10px">All badge types are now free - enjoy {{ c.EVENT_NAME }}!</div>
{% else %}
<select name="payment_method" class="form-control" onChange="maybeBold()">
<option value="">Select a payment option</option>
{% options c.DOOR_PAYMENT_METHOD_OPTS attendee.payment_method %}
</select>
{% endif %}
</div>
</div>

Expand Down

0 comments on commit eaabf4b

Please sign in to comment.