Skip to content

Commit

Permalink
Merge pull request #1871 from magfest/show_checkin_err_msg
Browse files Browse the repository at this point in the history
show error message if we can't check someone in
  • Loading branch information
binary1230 authored Jun 17, 2016
2 parents f0423c4 + c711eff commit 03fff38
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 21 deletions.
23 changes: 18 additions & 5 deletions uber/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1173,11 +1173,24 @@ def is_presold_oneday(self):
return self.badge_type_label in c.DAYS_OF_WEEK

@property
def can_check_in(self):
valid = self.paid != c.NOT_PAID and self.badge_status in [c.NEW_STATUS, c.COMPLETED_STATUS] and not self.is_unassigned
if valid and self.is_presold_oneday:
valid = self.badge_type_label == localized_now().strftime('%A')
return valid
def is_not_ready_to_checkin(self):
"""
:return: None if we are ready for checkin, otherwise a short error message why we can't check them in
"""
if self.paid == c.NOT_PAID:
return "Not paid"

if self.badge_status not in [c.NEW_STATUS, c.COMPLETED_STATUS]:
return "Badge status"

if self.is_unassigned:
return "Badge not assigned"

if self.is_presold_oneday:
if self.badge_type_label != localized_now().strftime('%A'):
return "Wrong day"

return None

@property
def shirt_size_marked(self):
Expand Down
35 changes: 19 additions & 16 deletions uber/templates/registration/index_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,24 +196,27 @@
<td id="amount_extra_{{ attendee.id }}">{{ attendee.amount_extra_label }}</td>
<td id="paid_{{ attendee.id }}" ><nobr>{{ attendee.paid_label }}</nobr></td>
<td> <nobr>{{ attendee.age_group_conf.desc }}</nobr> </td>
{% if c.AT_THE_CON and attendee.checked_in %}
<td>
{% if attendee.paid == c.LOST_BADGE %}
<strong>Badge reported as lost!</strong>
{% else %}
{{ attendee.checked_in_local|time:"fA"|lower }} {{ attendee.checked_in_local|date:"D" }} <br/>
<form method="post" action="lost_badge">
<input type="hidden" name="id" value="{{ attendee.id }}" />
<input type="submit" value="Report Lost Badge">
</form>
{% endif %}
{% if c.AT_THE_CON %}
{% if attendee.checked_in %}
<td>
{% if attendee.paid == c.LOST_BADGE %}
<strong>Badge reported as lost!</strong>
{% else %}
{{ attendee.checked_in_local|time:"fA"|lower }} {{ attendee.checked_in_local|date:"D" }} <br/>
<form method="post" action="lost_badge">
<input type="hidden" name="id" value="{{ attendee.id }}" />
<input type="submit" value="Report Lost Badge">
</form>
{% endif %}
</td>
{% elif attendee.is_not_ready_to_checkin %}
<td>Can't checkin ({{ attendee.is_not_ready_to_checkin }})</td>
{% else %}
<td id="cin_{{ attendee.id }}">
<button class="attendee-checkin" data-attendee-id="{{ attendee.id }}">Check In</button>
</td>
{% elif c.AT_THE_CON and attendee.can_check_in %}
<td id="cin_{{ attendee.id }}">
<button class="attendee-checkin" data-attendee-id="{{ attendee.id }}">Check In</button>
</td>
{% endif %}
{% endif %}
</td>
{% endblock tablerows %}
</tr>
{% endfor %}
Expand Down

0 comments on commit 03fff38

Please sign in to comment.