Project

General

Profile

0001-api-fix-datetimes-recurring-event-56615.patch

Lauréline Guerin, 04 Oct 2021 06:06 PM

Download (1.72 KB)

View differences:

Subject: [PATCH 1/5] api: fix datetimes & recurring event (#56615)

 chrono/agendas/models.py    | 1 +
 tests/api/test_datetimes.py | 8 ++++++++
 2 files changed, 9 insertions(+)
chrono/agendas/models.py
873 873
    def prefetch_events_and_exceptions(qs, annotate_events=False, user_external_id=None):
874 874
        event_queryset = Event.objects.filter(
875 875
            Q(publication_date__isnull=True) | Q(publication_date__lte=localtime(now()).date()),
876
            recurrence_days__isnull=True,
876 877
            cancelled=False,
877 878
            start_datetime__gte=localtime(now()),
878 879
        ).order_by()
tests/api/test_datetimes.py
1376 1376
        places=5,
1377 1377
        agenda=first_agenda,
1378 1378
    )
1379
    Event.objects.create(  # not visible in datetimes api
1380
        slug='recurring',
1381
        start_datetime=now() + datetime.timedelta(days=5),
1382
        recurrence_days=[localtime().weekday()],
1383
        recurrence_end_date=now() + datetime.timedelta(days=5),
1384
        places=5,
1385
        agenda=first_agenda,
1386
    )
1379 1387
    second_agenda = Agenda.objects.create(label='Second agenda', kind='events')
1380 1388
    Desk.objects.create(agenda=second_agenda, slug='_exceptions_holder')
1381 1389
    event = Event.objects.create(
1382
-