Пример #1
0
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))
Пример #2
0
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))
Пример #3
0
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')
Пример #4
0
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)
Пример #5
0
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)
Пример #6
0
    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)
Пример #7
0
def migrate():
    Entrant.create_table()
    Invitation.create_table()
Пример #8
0
 def has_reached_limit(self):
     attendees = Invitation.select().where(
         Invitation.state == Invitation.ACCEPTED_STATE).count()
     return attendees >= ATTENDEE_LIMIT
Пример #9
0
def migrate():
    Entrant.create_table()
    Invitation.create_table()