fix: remove duplicate exclusion block, replace continue with else branch

- Removed duplicate department exclusion check (was duplicated twice)
- Replaced 'continue' (invalid inside 'if ENABLE_AUTO_APPROVAL') with 'else:' branch
- Properly indented auto-approval logic inside the else block
This commit is contained in:
gitea
2026-07-04 18:50:40 +07:00
parent c3503975a0
commit 23960cbbb6
+16 -29
View File
@@ -899,35 +899,22 @@ def process_ticket_logic(req_id):
break break
if is_excluded: if is_excluded:
t_log(" ⏭ Пропуск: пользователь в исключённом отделе.") t_log(" ⏭ Пропуск: пользователь в исключённом отделе.")
continue else:
if is_city_ok and (is_group_ok or is_cat_ok):
# Проверка: отдел пользователя в списке исключений if manager_email:
is_excluded = False t_log(f"✔ Условия совпали. Запуск процесса согласования для {manager_email}...")
if user_department and APPROVAL_EXCLUDED_DEPARTMENTS: ai_was_used = True
for dept in APPROVAL_EXCLUDED_DEPARTMENTS:
if dept.lower() in user_department.lower() or user_department.lower() in dept.lower(): share_success, share_log = share_ticket_for_approval(req_id, manager_email)
is_excluded = True t_log(share_log)
t_log(f" ⚠️ Отдел '{user_department}' в списке исключений — автосогласование отменено")
break cc_success, cc_log = add_email_to_notify(req_id, manager_email)
if is_excluded: t_log(cc_log)
t_log(" ⏭ Пропуск: пользователь в исключённом отделе.")
continue success, step_detail = trigger_manager_approval(req_id, manager_email)
t_log(step_detail)
if is_city_ok and (is_group_ok or is_cat_ok): else:
if manager_email: t_log("⚠️ Согласование невозможно: у пользователя не указан руководитель в AD.")
t_log(f"✔ Условия совпали. Запуск процесса согласования для {manager_email}...")
ai_was_used = True
share_success, share_log = share_ticket_for_approval(req_id, manager_email)
t_log(share_log)
cc_success, cc_log = add_email_to_notify(req_id, manager_email)
t_log(cc_log)
success, step_detail = trigger_manager_approval(req_id, manager_email)
t_log(step_detail)
else:
t_log("⚠️ Согласование невозможно: у пользователя не указан руководитель в AD.")
else: else:
if ai_was_used: if ai_was_used:
t_log("\n=== ШАГ 5. АВТОСОГЛАСОВАНИЕ ===") t_log("\n=== ШАГ 5. АВТОСОГЛАСОВАНИЕ ===")