From 3a8dee79b590a6cc24f9b6a69c005868895b6d28 Mon Sep 17 00:00:00 2001 From: devketanpro Date: Thu, 9 Nov 2023 01:02:09 +0530 Subject: [PATCH] handle translated name and headline both --- server/planning/planning/planning.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/server/planning/planning/planning.py b/server/planning/planning/planning.py index 997665183..6793ed810 100644 --- a/server/planning/planning/planning.py +++ b/server/planning/planning/planning.py @@ -745,6 +745,9 @@ def _create_update_assignment( if entry["language"] == doc.get("planning", {}).get("language") } ) + + translated_name = translated_value.get("name", translated_value.get("headline")) + doc["planning"].update( { key: val @@ -761,8 +764,8 @@ def _create_update_assignment( if assigned_to.get("state") and assigned_to["state"] != ASSIGNMENT_WORKFLOW_STATE.DRAFT: assign_state = assigned_to.get("state") - if translated_value.get("name") and "headline" not in doc["planning"]: - doc["planning"]["headline"] = translated_value.get("name") + if translated_value and translated_name and "headline" not in doc["planning"]: + doc["planning"]["headline"] = translated_name assignment = { "assigned_to": { @@ -777,8 +780,8 @@ def _create_update_assignment( "priority": assigned_to.get("priority", DEFAULT_ASSIGNMENT_PRIORITY), "description_text": planning.get("description_text"), } - if translated_value.get("name") and assignment.get("name") != translated_value.get("name"): - assignment["name"] = translated_value.get("name") + if translated_value and translated_name and assignment.get("name") != translated_value.get("name"): + assignment["name"] = translated_name if doc.get("scheduled_update_id"): assignment["scheduled_update_id"] = doc["scheduled_update_id"] @@ -869,7 +872,7 @@ def _create_update_assignment( # If the Planning name has been changed if planning_original.get("name") != planning_updates.get("name"): - assignment["name"] = planning["name"] if not translated_value.get("name") else translated_value["name"] + assignment["name"] = planning["name"] if not translated_value and translated_name else translated_name # If there has been a change in the planning internal note then notify the assigned users/desk if planning_updates.get("internal_note") and planning_original.get("internal_note") != planning_updates.get(