Compare commits

..

2 Commits

Author SHA1 Message Date
gitea b7c25c4ff1 fix: add missing 'import os' (used on line 28 for sys.path) 2026-07-04 19:05:55 +07:00
gitea 23960cbbb6 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
2026-07-04 18:50:40 +07:00
+14 -26
View File
@@ -2,6 +2,7 @@
import requests import requests
import json import json
import urllib3 import urllib3
import os
import math import math
import warnings import warnings
import datetime import datetime
@@ -899,35 +900,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:
t_log(f"✔ Условия совпали. Запуск процесса согласования для {manager_email}...")
ai_was_used = True
# Проверка: отдел пользователя в списке исключений share_success, share_log = share_ticket_for_approval(req_id, manager_email)
is_excluded = False t_log(share_log)
if user_department and APPROVAL_EXCLUDED_DEPARTMENTS:
for dept in APPROVAL_EXCLUDED_DEPARTMENTS:
if dept.lower() in user_department.lower() or user_department.lower() in dept.lower():
is_excluded = True
t_log(f" ⚠️ Отдел '{user_department}' в списке исключений — автосогласование отменено")
break
if is_excluded:
t_log(" ⏭ Пропуск: пользователь в исключённом отделе.")
continue
if is_city_ok and (is_group_ok or is_cat_ok): cc_success, cc_log = add_email_to_notify(req_id, manager_email)
if manager_email: t_log(cc_log)
t_log(f"✔ Условия совпали. Запуск процесса согласования для {manager_email}...")
ai_was_used = True
share_success, share_log = share_ticket_for_approval(req_id, manager_email) success, step_detail = trigger_manager_approval(req_id, manager_email)
t_log(share_log) t_log(step_detail)
else:
cc_success, cc_log = add_email_to_notify(req_id, manager_email) t_log("⚠️ Согласование невозможно: у пользователя не указан руководитель в AD.")
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. АВТОСОГЛАСОВАНИЕ ===")