From 3806c55af54122eb966235cc7c85cf31d72acad4 Mon Sep 17 00:00:00 2001 From: Carlos Vega <carlos.vega@uni.lu> Date: Tue, 11 Dec 2018 12:40:04 +0100 Subject: [PATCH] manual cherry pick of the fix for the appointmentType 'other' issue --- smash/web/management/commands/holidays.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/smash/web/management/commands/holidays.py b/smash/web/management/commands/holidays.py index 7c01d080..ab0db550 100644 --- a/smash/web/management/commands/holidays.py +++ b/smash/web/management/commands/holidays.py @@ -4,9 +4,6 @@ from django.core.management.base import BaseCommand from ...models import Appointment, Location, AppointmentType, AppointmentTypeLink -appointment_type_other = AppointmentType.objects.filter(code='OTHER').first() - - def get_easter_monday(easter_sunday): return next_weekday(easter_sunday, 0) @@ -64,6 +61,7 @@ class Command(BaseCommand): holiday.comment = comment holiday.visit_id = None holiday.save() + appointment_type_other = AppointmentType.objects.get_or_create(code='OTHER', defaults={default_duration: 60}) link = AppointmentTypeLink(appointment=holiday, appointment_type=appointment_type_other) link.save() @@ -92,4 +90,4 @@ def next_weekday(day_datetime, week_day): days_ahead = week_day - day_datetime.weekday() if days_ahead <= 0: days_ahead += 7 - return day_datetime + datetime.timedelta(days_ahead) + return day_datetime + datetime.timedelta(days_ahead) \ No newline at end of file -- GitLab