From 00a7c9738f7440e5178a9384eedc43643bd3ee31 Mon Sep 17 00:00:00 2001 From: Shaunna Samuels Date: Fri, 8 Nov 2024 10:43:41 -0500 Subject: [PATCH] Fix: Add missing auto-assign attribute to the applet duplication function (M2-8150) (#1651) * Update activity and flows auto-assign base value to false. * reset values for activity base and flow base. * Add missing properties to activity and activity flow applet duplicate functions. * Fix formatting * Update time value to account for what seems like a daylight savings issue(?). --- src/apps/activities/services/activity.py | 1 + src/apps/activity_flows/service/flow.py | 1 + src/apps/applets/service/applet.py | 2 ++ src/infrastructure/tests/unit/http/test_deps.py | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/apps/activities/services/activity.py b/src/apps/activities/services/activity.py index 82a82ce2259..ea7ef7b89cd 100644 --- a/src/apps/activities/services/activity.py +++ b/src/apps/activities/services/activity.py @@ -336,6 +336,7 @@ async def get_by_applet_id_for_duplicate(self, applet_id: uuid.UUID) -> list[Act subscale_setting=schema.subscale_setting, performance_task_type=schema.performance_task_type, is_performance_task=schema.is_performance_task, + auto_assign=schema.auto_assign, ) activity_map[activity.id] = activity activities.append(activity) diff --git a/src/apps/activity_flows/service/flow.py b/src/apps/activity_flows/service/flow.py index 894e7d02658..391d67d7c68 100644 --- a/src/apps/activity_flows/service/flow.py +++ b/src/apps/activity_flows/service/flow.py @@ -229,6 +229,7 @@ async def get_by_applet_id_duplicate(self, applet_id: uuid.UUID) -> list[FlowDup hide_badge=schema.hide_badge, order=schema.order, is_hidden=schema.is_hidden, + auto_assign=schema.auto_assign, ) flow_map[flow.id] = flow flows.append(flow) diff --git a/src/apps/applets/service/applet.py b/src/apps/applets/service/applet.py index 6b6bb85ad37..84d05b8c45f 100644 --- a/src/apps/applets/service/applet.py +++ b/src/apps/applets/service/applet.py @@ -274,6 +274,7 @@ def _prepare_duplicate( report_included_item_name=activity.report_included_item_name, # noqa: E501 subscale_setting=activity.subscale_setting, scores_and_reports=activity.scores_and_reports, + auto_assign=activity.auto_assign, ) ) @@ -289,6 +290,7 @@ def _prepare_duplicate( items=[FlowItemCreate(activity_key=item) for item in activity_flow.activity_ids], report_included_activity_name=activity_flow.report_included_activity_name, # noqa: E501 report_included_item_name=activity_flow.report_included_item_name, # noqa: E501 + auto_assign=activity_flow.auto_assign, ) ) diff --git a/src/infrastructure/tests/unit/http/test_deps.py b/src/infrastructure/tests/unit/http/test_deps.py index 5217bb1ceb0..b2135a28ee4 100644 --- a/src/infrastructure/tests/unit/http/test_deps.py +++ b/src/infrastructure/tests/unit/http/test_deps.py @@ -47,7 +47,7 @@ def test_get_local_tz__exception(headers: list, required: bool, details: str): ( ("UTC", 0), ("EST", -5 * 60 * 60), - ("US/Pacific", -7 * 60 * 60), + ("US/Pacific", -8 * 60 * 60), ("wrong-timezone", None), (None, None), ),