Esempio n. 1
0
 def perform_check_tickets():
     # using try to prevent thread from stopping
     try:
         tickets_util.check_tickets()
     except:
         # ideally, we should log our exception here
         pass
     
     s.enter(check_delay, 1, perform_check_tickets, ())
Esempio n. 2
0
    def perform_check_tickets():
        # using try to prevent thread from stopping
        try:
            tickets_util.check_tickets()
        except:
            # ideally, we should log our exception here
            pass

        s.enter(check_delay, 1, perform_check_tickets, ())
Esempio n. 3
0
def ticket_ajax_check(request):
    ''' Checking tickets with ajax '''
    win_tickets = tickets_util.check_tickets()
    user_wins = [t for t in win_tickets if t.user.id == request.user.id]
    
    upcoming = request.GET.get('upcoming', 'false') != 'false'
    
    tickets = Ticket.objects.filter(user=request.user)
    if upcoming:
        tickets = tickets.filter(date__gte=datetime.now().date())
        
    return render(request, 'lotto/ticket/list-snippet.html', {
        'tickets': tickets,
        'upcoming': upcoming,
        'ajax': True,
        'win_tickets': len(win_tickets),
        'user_wins': len(user_wins),
    });
Esempio n. 4
0
def ticket_ajax_check(request):
    ''' Checking tickets with ajax '''
    win_tickets = tickets_util.check_tickets()
    user_wins = [t for t in win_tickets if t.user.id == request.user.id]

    upcoming = request.GET.get('upcoming', 'false') != 'false'

    tickets = Ticket.objects.filter(user=request.user)
    if upcoming:
        tickets = tickets.filter(date__gte=datetime.now().date())

    return render(
        request, 'lotto/ticket/list-snippet.html', {
            'tickets': tickets,
            'upcoming': upcoming,
            'ajax': True,
            'win_tickets': len(win_tickets),
            'user_wins': len(user_wins),
        })
Esempio n. 5
0
def ticket_check(request):
    ''' Just calls ticket_check function, used for for debugging purposes. '''
    tickets_util.check_tickets()
    messages.add_message(request, messages.INFO, 'Tickets checked.')
    return ticket_list(request)
Esempio n. 6
0
def ticket_check(request):
    ''' Just calls ticket_check function, used for for debugging purposes. '''
    tickets_util.check_tickets()
    messages.add_message(request, messages.INFO, 'Tickets checked.')
    return ticket_list(request)