<commit_before>from django.db.models import Sum

from .models import Event, Postmortem
from jobs.models import Meetup


def statistics(request):
    future_events = Event.objects.future()
    past_events = Event.objects.past()
    countries = Event.objects.values('country').distinct()
    attendees = Postmortem.objects.all().aggregate(attendees=Sum('attendees_count'), applicants=Sum('applicants_count'))
    meetup_count = Meetup.visible_objects.all()

    return {
        'past_events_count': past_events.count(),
        'future_events_count': future_events.count(),
        'countries_count': countries.count(),
        'attendees_sum': attendees['attendees'],
        'applicants_sum': attendees['applicants'],
        'meetup_count': meetup_count.count()
    }<commit_msg>save SQL query on meetup_count<commit_after>from django.db.models import Sum

from .models import Event, Postmortem
from jobs.models import Meetup


def statistics(request):
    future_events = Event.objects.future()
    past_events = Event.objects.past()
    countries = Event.objects.values('country').distinct()
    attendees = Postmortem.objects.all().aggregate(attendees=Sum('attendees_count'), applicants=Sum('applicants_count'))
    meetup_count = Meetup.visible_objects.count()

    return {
        'past_events_count': past_events.count(),
        'future_events_count': future_events.count(),
        'countries_count': countries.count(),
        'attendees_sum': attendees['attendees'],
        'applicants_sum': attendees['applicants'],
        'meetup_count': meetup_count
    }
{'fraction_non_alphanumeric': 0.12523839796567068, 'fraction_numerical': 0.0, 'mean_word_length': 4.35374149659864, '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': '7455964', 'n_tokens_mistral': 491, 'n_tokens_neox': 457, 'n_words': 82}