From b61a331ce6c2559354ba18ac57d9a2459d6fe2de Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Tue, 8 Jan 2019 18:16:46 -0500 Subject: [PATCH] Use `deepcopy` to copy form section info Previously, copying the form sections was using `list.copy` which creates a shallow copy of the list. Since the `TASK_ORDER_SECTIONS` list contains a couple dictionaries, this was just creating another list with references to the same dictionaries. Therefore, when a section was marked as completed, it was updated globally and visiting the new task order without filling anything out would show some sections as completed. --- atst/routes/task_orders/new.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/atst/routes/task_orders/new.py b/atst/routes/task_orders/new.py index ddbb477e..eb542340 100644 --- a/atst/routes/task_orders/new.py +++ b/atst/routes/task_orders/new.py @@ -1,3 +1,5 @@ +from copy import deepcopy + from flask import ( request as http_request, render_template, @@ -90,7 +92,7 @@ class ShowTaskOrderWorkflow: @property def display_screens(self): - screen_info = TASK_ORDER_SECTIONS.copy() + screen_info = deepcopy(TASK_ORDER_SECTIONS) if self.task_order: for section in screen_info: