def check_in(self, session, message='', group_id='', **params): bools = ['got_merch'] if c.MERCH_AT_CHECKIN else [] attendee = session.attendee(params, allow_invalid=True, bools=bools) group = attendee.group or (session.group(group_id) if group_id else None) pre_badge = attendee.badge_num success, increment = False, False message = pre_checkin_check(attendee, group) if not message and group_id: message = session.match_to_group(attendee, group) if not message and attendee.paid == c.PAID_BY_GROUP and not attendee.group_id: message = 'You must select a group for this attendee.' if not message: message = '' success = True attendee.checked_in = localized_now() session.commit() increment = True message += '{} checked in as {}{}'.format(attendee.full_name, attendee.badge, attendee.accoutrements) return { 'success': success, 'message': message, 'increment': increment, 'badge': attendee.badge, 'paid': attendee.paid_label, 'age_group': attendee.age_group_conf['desc'], 'pre_badge': pre_badge, 'checked_in': attendee.checked_in and hour_day_format(attendee.checked_in) }
def check_in(self, session, message='', group_id='', **params): attendee = session.attendee(params, allow_invalid=True) group = attendee.group or (session.group(group_id) if group_id else None) pre_badge = attendee.badge_num success, increment = False, False message = pre_checkin_check(attendee, group) if not message and group_id: message = session.match_to_group(attendee, group) if not message and attendee.paid == c.PAID_BY_GROUP and not attendee.group_id: message = 'You must select a group for this attendee.' if not message: message = '' success = True attendee.checked_in = localized_now() session.commit() increment = True message += '{} checked in as {}{}'.format(attendee.full_name, attendee.badge, attendee.accoutrements) return { 'success': success, 'message': message, 'increment': increment, 'badge': attendee.badge, 'paid': attendee.paid_label, 'age_group': attendee.age_group_conf['desc'], 'pre_badge': pre_badge, 'checked_in': attendee.checked_in and hour_day_format(attendee.checked_in) }
def hour_day_local(dt): # NOTE: hour_day_format() already localizes the given datetime object return '' if not dt else hour_day_format(dt)
def possible_opts(self): return [(job.id, '({}) [{}] {}'.format(hour_day_format(job.start_time), job.department_name, job.name)) for job in self.possible if localized_now() < job.start_time]