From b669151a0a9c00b0210864d03a9f5cfbce4646bd Mon Sep 17 00:00:00 2001 From: RitvikSardana Date: Wed, 13 Nov 2024 15:50:27 +0530 Subject: [PATCH] refactor: patch --- helpdesk/patches/update_hd_team_users.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/helpdesk/patches/update_hd_team_users.py b/helpdesk/patches/update_hd_team_users.py index 42ed91b06..e162cb065 100644 --- a/helpdesk/patches/update_hd_team_users.py +++ b/helpdesk/patches/update_hd_team_users.py @@ -13,14 +13,10 @@ def execute(): for agent in existing_agents: is_agent_active = frappe.get_value("HD Agent", agent, "is_active") - if not is_agent_active: - continue - - if is_agent_active: - if agent not in team_users: - team_doc = ( - frappe.get_doc("HD Team", team) - .append("users", {"user": agent}) - .save() - ) - print("Agent Added") + if is_agent_active and agent not in team_users: + team_doc = ( + frappe.get_doc("HD Team", team) + .append("users", {"user": agent}) + .save() + ) + print("Agent Added")