From c483410cf204b9b8dbdf7f8c356f895badd24a96 Mon Sep 17 00:00:00 2001 From: Yoan Le Clanche Date: Wed, 15 Feb 2023 10:15:52 +0100 Subject: [PATCH] set 'streaming' false when conference is over : https://trackers.pilotsystems.net/prebarreau/0637 --- .../teleforma-publish-notify-conferences.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/teleforma/management/commands/teleforma-publish-notify-conferences.py b/teleforma/management/commands/teleforma-publish-notify-conferences.py index 58f2f8a5..f2a457d1 100644 --- a/teleforma/management/commands/teleforma-publish-notify-conferences.py +++ b/teleforma/management/commands/teleforma-publish-notify-conferences.py @@ -70,8 +70,9 @@ class Command(BaseCommand): if not minute_high_range: minute_high_range = MINUTES_HIGH_RANGE - now_minus = datetime.datetime.now() - datetime.timedelta(minutes=minute_low_range) - now_plus = datetime.datetime.now() + datetime.timedelta(minutes=minute_high_range) + now = datetime.datetime.now() + now_minus = now - datetime.timedelta(minutes=minute_low_range) + now_plus = now + datetime.timedelta(minutes=minute_high_range) publications = list(Conference.objects.filter( period=period, @@ -95,7 +96,6 @@ class Command(BaseCommand): if type(publication) == ConferencePublication: conference = publication.conference else: - conference = publication medias = conference.media.all() @@ -138,5 +138,12 @@ class Command(BaseCommand): publication.notified = True publication.save() - + # streaming published end conference should have a streaming propery set to False + for conference in Conference.objects.filter( + period=period, + status=3, + streaming=True, + date_end__lt=now): + conference.streaming = False + conference.save() -- 2.39.5