def status(): entrants = Entrant.select().count() invited = Invitation.select().where(Invitation.state == Invitation.INVITED_STATE).count() accepted = Invitation.select().where(Invitation.state == Invitation.ACCEPTED_STATE).count() rejected = Invitation.select().where(Invitation.state == Invitation.REJECTED_STATE).count() print('Entrants: {}\n---'.format(entrants)) print('Invited: {}'.format(invited)) print('Accepted: {}'.format(accepted)) print('Rejected: {}'.format(rejected))
def status(): entrants = Entrant.select().count() invited = Invitation.select().where( Invitation.state == Invitation.INVITED_STATE).count() accepted = Invitation.select().where( Invitation.state == Invitation.ACCEPTED_STATE).count() rejected = Invitation.select().where( Invitation.state == Invitation.REJECTED_STATE).count() print('Entrants: {}\n---'.format(entrants)) print('Invited: {}'.format(invited)) print('Accepted: {}'.format(accepted)) print('Rejected: {}'.format(rejected))
def status_view(request): status = { 'entrants': Entrant.select().count(), 'invited': Invitation.select().where( Invitation.state == Invitation.INVITED_STATE).count(), 'accepted': Invitation.select().where( Invitation.state == Invitation.ACCEPTED_STATE).count(), 'rejected': Invitation.select().where( Invitation.state == Invitation.REJECTED_STATE).count(), } return Response(json.dumps(status), content_type='application/json')
def remind(): """ Sends out a reminder to all of the outstanding invitees who have not yet accepted or rejected. """ invitations = Invitation.select().where(Invitation.state == Invitation.INVITED_STATE) for invitation in invitations: send_reminder(invitation)
def remind(): """ Sends out a reminder to all of the outstanding invitees who have not yet accepted or rejected. """ invitations = Invitation.select().where( Invitation.state == Invitation.INVITED_STATE) for invitation in invitations: send_reminder(invitation)
def get(self, *args, **kwargs): try: self.invitation = Invitation.select().where( Invitation.code == kwargs['code']).get() except Invitation.DoesNotExist: raise Http404 if self.invitation.state not in self.expected_states: raise Http404 if self.invitation.state == Invitation.REMOVED_STATE: return ResponseRedirect('https://sotu.cocoapods.org/removed') if self.enforce_attendee_limit and self.has_reached_limit and self.invitation.state == Invitation.INVITED_STATE: return ResponseRedirect('https://sotu.cocoapods.org/cap') self.perform(self.invitation) return super(InvitationView, self).get(*args, **kwargs)
def migrate(): Entrant.create_table() Invitation.create_table()
def has_reached_limit(self): attendees = Invitation.select().where( Invitation.state == Invitation.ACCEPTED_STATE).count() return attendees >= ATTENDEE_LIMIT