From f10bea7765df4d5feb17436ca75fb4d2951f3d6d Mon Sep 17 00:00:00 2001 From: Phil Elson Date: Fri, 6 Nov 2020 17:25:31 +0100 Subject: [PATCH] Fix permalunch. Closes #57. --- cara/apps/calculator/model_generator.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/cara/apps/calculator/model_generator.py b/cara/apps/calculator/model_generator.py index ba64dd1e..907a78b2 100644 --- a/cara/apps/calculator/model_generator.py +++ b/cara/apps/calculator/model_generator.py @@ -163,8 +163,11 @@ class FormData: return tuple(coffee_times) def present_interval(self) -> models.Interval: - leave_times = [self.lunch_start] - enter_times = [self.lunch_finish] + leave_times = [] + enter_times = [] + if self.lunch_option: + leave_times.append(self.lunch_start) + enter_times.append(self.lunch_finish) for coffee_start, coffee_end in self.coffee_break_times(): leave_times.append(coffee_start) @@ -212,12 +215,6 @@ class FormData: def model_from_form(form: FormData, tmp_raw_form_data) -> models.Model: d = tmp_raw_form_data - # TODO: This fixup is a problem with the form.html. - d['coffee_breaks'] = 1 - d['activity_type'] = 'Training' - d['lunch_start'] = '12:00' - d['lunch_finish'] = '13:00' - # Initializes room with volume either given directly or as product of area and height if form.volume_type == 'room_volume': volume = form.room_volume