From d272d12d245defb3cd0a6c3b5fc32c4f5ce1e0ce Mon Sep 17 00:00:00 2001 From: Ivo Oskamp Date: Mon, 19 Jan 2026 13:31:09 +0100 Subject: [PATCH] Auto-commit local changes before build (2026-01-19 13:31:09) --- .last-branch | 2 +- .../src/backend/app/main/routes_run_checks.py | 15 +++++++++++++++ docs/changelog.md | 8 ++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.last-branch b/.last-branch index 558ed93..0dcaca2 100644 --- a/.last-branch +++ b/.last-branch @@ -1 +1 @@ -v20260119-06-runchecks-renderRun-fix +v20260119-07-autotask-propagate-ticket-to-all-runs diff --git a/containers/backupchecks/src/backend/app/main/routes_run_checks.py b/containers/backupchecks/src/backend/app/main/routes_run_checks.py index fb4120d..fc467cf 100644 --- a/containers/backupchecks/src/backend/app/main/routes_run_checks.py +++ b/containers/backupchecks/src/backend/app/main/routes_run_checks.py @@ -1091,12 +1091,27 @@ def api_run_checks_create_autotask_ticket(): if existing_id and int(existing_id) != ticket_id_int: continue + # Ensure all open runs get BOTH the Autotask ticket id and number. + # Some runs may already have the id (indicator) but still miss the number. if not existing_id: r.autotask_ticket_id = ticket_id_int r.autotask_ticket_number = ticket_number_str r.autotask_ticket_created_at = getattr(run, "autotask_ticket_created_at", None) r.autotask_ticket_created_by_user_id = getattr(run, "autotask_ticket_created_by_user_id", None) db.session.add(r) + else: + updated = False + if not (getattr(r, "autotask_ticket_number", None) or "").strip(): + r.autotask_ticket_number = ticket_number_str + updated = True + if getattr(r, "autotask_ticket_created_at", None) is None: + r.autotask_ticket_created_at = getattr(run, "autotask_ticket_created_at", None) + updated = True + if getattr(r, "autotask_ticket_created_by_user_id", None) is None: + r.autotask_ticket_created_by_user_id = getattr(run, "autotask_ticket_created_by_user_id", None) + updated = True + if updated: + db.session.add(r) run_ids_to_link.append(int(r.id)) diff --git a/docs/changelog.md b/docs/changelog.md index 97d6e7f..aaa15ce 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -248,6 +248,14 @@ Changes: - Replaced the invalid renderModal() call with renderRun() to correctly refresh the run state and UI. - Prevented UI failure after successful Autotask ticket creation while preserving backend behavior. +## v20260119-07-autotask-propagate-ticket-to-all-runs + +Changes: +- Fixed ticket propagation logic so Autotask ticket numbers are applied to all open runs (reviewed_at IS NULL), not only the most recent run. +- Ensured runs that already had an autotask_ticket_id but were missing the autotask_ticket_number are now correctly updated. +- Restored legacy behavior where all active runs for the same job consistently display the linked ticket in Tickets, Tickets/Remarks, and Job Details. +- Prevented partial ticket linkage that caused only the newest run to show the ticket number. + *** ## v0.1.21