Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New configuration option for free late badges #1703

Merged
merged 2 commits into from
Feb 14, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this a terrible, terrible thing for our records? We should be marking them as 'need not pay' right?

Otherwise someone could come in and claim they paid and want a refund, and the system would show that they paid, and we'd be all atizzy trying to figure out what happened.

EDIT: Wait, that's exactly what you do. Can you make the comment reflect reality? :P

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, good catch! I swear I typed "marked as need not pay" but apparently not! Sorry for the confusion, I'll push out an updated comment in just a minute.

# 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)]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although we'll probably stop using this page once badges becomes free, it struck me that there's never any reason for a need not pay badge to ever show up here, so I added that filter. Now free badges added by admins on-site won't show up here either.


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');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we can no longer rely on the "Payment Method" field always being present on this page, I added an if check to avoid Javascript errors.

}
};
$(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