<commit_before>import datetime
import sys
import traceback

from django.contrib import messages
from django.contrib.auth.views import LogoutView
from django.http import HttpResponse, HttpResponseServerError
from django.template import loader
from django.views.generic import TemplateView

from chipy_org.apps.announcements.models import Announcement
from chipy_org.apps.meetings.models import Meeting
from chipy_org.apps.meetings.views import InitialRSVPMixin
from chipy_org.apps.sponsors.models import Sponsor, SponsorGroup


class Home(TemplateView, InitialRSVPMixin):
    template_name = "main/homepage.html"

    def get_non_main_meetings(self, num):
        return (
            Meeting.objects.filter(meeting_type__isnull=False)
            .filter(when__gt=datetime.datetime.now() - datetime.timedelta(hours=6))
            .order_by("when")[:num]
        )

    def get_meeting(self):
        return (
            Meeting.objects.filter(meeting_type__isnull=True)
            .filter(when__gt=datetime.datetime.now() - datetime.timedelta(hours=6))
            .order_by("when")
            .first()
        )

    def get_context_data(self, **kwargs):
        context = {}
        context.update(kwargs)
        context["IS_HOMEPAGE"] = True
        context["other_meetings"] = self.get_non_main_meetings(num=3)
        context["featured_sponsor"] = Sponsor.featured_sponsor()
        context["sponsor_groups"] = SponsorGroup.objects.prefetch_related("sponsors")
        context["announcement"] = Announcement.objects.featured()

        context = self.add_extra_context(context)
        return context<commit_msg>Change get_meeting() so that it gets the next meeting from all of the meetings, not just the next __main__ meeting<commit_after>import datetime
import sys
import traceback

from django.contrib import messages
from django.contrib.auth.views import LogoutView
from django.http import HttpResponse, HttpResponseServerError
from django.template import loader
from django.views.generic import TemplateView

from chipy_org.apps.announcements.models import Announcement
from chipy_org.apps.meetings.models import Meeting
from chipy_org.apps.meetings.views import InitialRSVPMixin
from chipy_org.apps.sponsors.models import Sponsor, SponsorGroup


class Home(TemplateView, InitialRSVPMixin):
    template_name = "main/homepage.html"

    def get_meeting(self):
        return (
            Meeting.objects
            .filter(when__gt=datetime.datetime.now() - datetime.timedelta(hours=6))
            .order_by("when")
            .first()
        )

    def get_context_data(self, **kwargs):
        context = {}
        context.update(kwargs)
        context["IS_HOMEPAGE"] = True
        context["featured_sponsor"] = Sponsor.featured_sponsor()

        context = self.add_extra_context(context)
        return context
{'fraction_non_alphanumeric': 0.08744710860366714, 'fraction_numerical': 0.0014104372355430183, 'mean_word_length': 3.5831987075928917, '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': '490838', 'n_tokens_mistral': 838, 'n_tokens_neox': 810, 'n_words': 172}