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.
This commit is contained in:
Patrick Smith 2019-01-08 18:16:46 -05:00
parent 7b2e74f2f5
commit b61a331ce6

View File

@ -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: