<commit_before>from django.http import HttpResponse, HttpResponseRedirect
from django.http import Http404
from django.template import loader
from django.shortcuts import render
from django.db.models import Count, Sum
from django.views.decorators.csrf import csrf_protect
from django.core import serializers
from .models import Drawing, PrizesWon, GroupTicket, PaidOut


def index(request):
    allDrawings = Drawing.objects.order_by('-drawingDate')[:50]
    allPrizes = PrizesWon.objects.order_by('-drawing__drawingDate')
    activeTickets = GroupTicket.objects.order_by('-numbers')
    toBePaid = PrizesWon.objects.filter(ticket__active=True).aggregate(Sum('groupPrizeAmount'))
    paidOut = PaidOut.objects.aggregate(Sum('prizeAmount'))
    context = {'allDrawings': allDrawings, 'allPrizes': allPrizes, 'toBePaid':toBePaid, 'activeTickets':activeTickets,'paidOut':paidOut}
    return render(request, 'results/index.html', context)


@csrf_protect
def matchingTickets(request,drawingid,ticketid):
    a = Drawing.objects.get(pk=drawingid)
    b = GroupTicket.objects.get(pk=ticketid)
    return HttpResponse(str(a)+str(b))


@csrf_protect
def results(request,drawingid):
    a = Drawing.objects.get(pk=drawingid)
    return HttpResponse(str(a))<commit_msg>Only show active tickets on homepage<commit_after>from django.http import HttpResponse, HttpResponseRedirect
from django.http import Http404
from django.template import loader
from django.shortcuts import render
from django.db.models import Count, Sum
from django.views.decorators.csrf import csrf_protect
from django.core import serializers
from .models import Drawing, PrizesWon, GroupTicket, PaidOut


def index(request):
    allDrawings = Drawing.objects.order_by('-drawingDate')[:50]
    allPrizes = PrizesWon.objects.order_by('-drawing__drawingDate')
    activeTickets = GroupTicket.objects.filter(ticket__active=True).order_by('-numbers')
    toBePaid = PrizesWon.objects.filter(ticket__active=True).aggregate(Sum('groupPrizeAmount'))
    paidOut = PaidOut.objects.aggregate(Sum('prizeAmount'))
    context = {'allDrawings': allDrawings, 'allPrizes': allPrizes, 'toBePaid':toBePaid, 'activeTickets':activeTickets,'paidOut':paidOut}
    return render(request, 'results/index.html', context)


@csrf_protect
def matchingTickets(request,drawingid,ticketid):
    a = Drawing.objects.get(pk=drawingid)
    b = GroupTicket.objects.get(pk=ticketid)
    return HttpResponse(str(a)+str(b))


@csrf_protect
def results(request,drawingid):
    a = Drawing.objects.get(pk=drawingid)
    return HttpResponse(str(a))
{'fraction_non_alphanumeric': 0.11141410206466693, 'fraction_numerical': 0.0038955979742890533, 'mean_word_length': 6.358166189111748, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7010649', 'n_tokens_mistral': 862, 'n_tokens_neox': 819, 'n_words': 156}