From 01ec66440f775d559805b25bcd408602f68826f0 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sun, 21 May 2023 15:16:44 +0200 Subject: [PATCH] feat: mockdata for in/out garbage --- .../management/commands/mockdata.py | 42 +++++++++++++------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/backend/drtrottoir/management/commands/mockdata.py b/backend/drtrottoir/management/commands/mockdata.py index 7e2d7a93..d01fbaf1 100644 --- a/backend/drtrottoir/management/commands/mockdata.py +++ b/backend/drtrottoir/management/commands/mockdata.py @@ -315,12 +315,16 @@ def local_image_path_to_django_image_data(image_path: str) -> File: ] garbage = [ - "Rest", - "GFT", - "Glas", - "PMD", - "KGA", - "Nucleair", + "Rest (In)", + "Rest (Out)", + "GFT (In)", + "GFT (Out)", + "Glas (In)", + "Glas (Out)", + "PMD (In)", + "PMD (Out)", + "KGA (In)", + "KGA (Out)", ] building_images = [ @@ -572,14 +576,28 @@ def handle(self, *args, **options): # Add garbage schedules for building in buildings_in_schedule_definition_of_0: - garbage_collection_schedule_1 = GarbageCollectionSchedule( - for_day=date, building=building, garbage_type=garbage_types[0] - ) - garbage_collection_schedule_2 = GarbageCollectionSchedule( + garbage_collection_schedule_1_in = GarbageCollectionSchedule( for_day=date, building=building, garbage_type=garbage_types[1] ) - garbage_collection_schedule_1.save() - garbage_collection_schedule_2.save() + garbage_collection_schedule_1_out = GarbageCollectionSchedule( + for_day=datetime.datetime.strptime(date, "%Y-%m-%d") + + datetime.timedelta(days=1), + building=building, + garbage_type=garbage_types[0], + ) + garbage_collection_schedule_2_in = GarbageCollectionSchedule( + for_day=date, building=building, garbage_type=garbage_types[3] + ) + garbage_collection_schedule_2_out = GarbageCollectionSchedule( + for_day=datetime.datetime.strptime(date, "%Y-%m-%d") + + datetime.timedelta(days=1), + building=building, + garbage_type=garbage_types[2], + ) + garbage_collection_schedule_1_in.save() + garbage_collection_schedule_1_out.save() + garbage_collection_schedule_2_in.save() + garbage_collection_schedule_2_out.save() # Add work entries work_entries = []