Fix Job Details page showing resolved tickets
The Job Details page used the same date-based logic that was causing resolved tickets to appear for runs on the same day as the resolve date. The linking was already fixed in ticketing_utils.py, but the display query in routes_jobs.py still used the old logic, causing a mismatch: - New runs were correctly NOT linked to resolved tickets - But the UI still SHOWED resolved tickets due to the display query Changes: - Removed date-based OR clause from tickets query (line 201-204) - Removed date-based OR clause from remarks query (line 239-242) - Simplified query parameters (removed min_date and ui_tz) - Now both linking AND display use consistent logic: resolved = hidden Result: Resolved tickets and remarks no longer appear in Job Details or any other view, matching the expected behavior. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
1b5effc5d2
commit
a9cae0f8f5
@ -198,14 +198,10 @@ def job_detail(job_id: int):
|
|||||||
JOIN ticket_scopes ts ON ts.ticket_id = t.id
|
JOIN ticket_scopes ts ON ts.ticket_id = t.id
|
||||||
WHERE ts.job_id = :job_id
|
WHERE ts.job_id = :job_id
|
||||||
AND t.active_from_date <= :max_date
|
AND t.active_from_date <= :max_date
|
||||||
AND (
|
AND COALESCE(ts.resolved_at, t.resolved_at) IS NULL
|
||||||
COALESCE(ts.resolved_at, t.resolved_at) IS NULL
|
|
||||||
OR ((COALESCE(ts.resolved_at, t.resolved_at) AT TIME ZONE 'UTC' AT TIME ZONE :ui_tz)::date) >= :min_date
|
|
||||||
)
|
|
||||||
"""
|
"""
|
||||||
),
|
),
|
||||||
{"job_id": job.id, "min_date": min_date,
|
{"job_id": job.id, "max_date": max_date},
|
||||||
"ui_tz": _get_ui_timezone_name(), "max_date": max_date},
|
|
||||||
)
|
)
|
||||||
.mappings()
|
.mappings()
|
||||||
.all()
|
.all()
|
||||||
@ -240,14 +236,10 @@ def job_detail(job_id: int):
|
|||||||
r.active_from_date,
|
r.active_from_date,
|
||||||
((r.start_date AT TIME ZONE 'UTC' AT TIME ZONE :ui_tz)::date)
|
((r.start_date AT TIME ZONE 'UTC' AT TIME ZONE :ui_tz)::date)
|
||||||
) <= :max_date
|
) <= :max_date
|
||||||
AND (
|
AND r.resolved_at IS NULL
|
||||||
r.resolved_at IS NULL
|
|
||||||
OR ((r.resolved_at AT TIME ZONE 'UTC' AT TIME ZONE :ui_tz)::date) >= :min_date
|
|
||||||
)
|
|
||||||
"""
|
"""
|
||||||
),
|
),
|
||||||
{"job_id": job.id, "min_date": min_date,
|
{"job_id": job.id, "max_date": max_date},
|
||||||
"ui_tz": _get_ui_timezone_name(), "max_date": max_date},
|
|
||||||
)
|
)
|
||||||
.mappings()
|
.mappings()
|
||||||
.all()
|
.all()
|
||||||
|
|||||||
@ -7,6 +7,7 @@ This file documents all changes made to this project via Claude Code.
|
|||||||
### Fixed
|
### Fixed
|
||||||
- Fixed Autotask ticket not being automatically linked to new runs when internal ticket is resolved by implementing independent Autotask propagation strategy (now checks for most recent non-deleted and non-resolved Autotask ticket on job regardless of internal ticket status, ensuring PSA ticket reference persists across runs until explicitly resolved or deleted)
|
- Fixed Autotask ticket not being automatically linked to new runs when internal ticket is resolved by implementing independent Autotask propagation strategy (now checks for most recent non-deleted and non-resolved Autotask ticket on job regardless of internal ticket status, ensuring PSA ticket reference persists across runs until explicitly resolved or deleted)
|
||||||
- Fixed internal and Autotask tickets being linked to new runs even after being resolved by removing date-based "open" logic from ticket query (tickets now only link to new runs if they are genuinely unresolved, not based on run date comparisons)
|
- Fixed internal and Autotask tickets being linked to new runs even after being resolved by removing date-based "open" logic from ticket query (tickets now only link to new runs if they are genuinely unresolved, not based on run date comparisons)
|
||||||
|
- Fixed Job Details page showing resolved tickets in the Tickets column by removing date-based logic from display query (tickets and remarks now only show if genuinely unresolved, matching the linking behavior)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Added debug logging to ticket linking function to troubleshoot resolved ticket propagation issues (writes to AuditLog table with event_type "ticket_link_debug", visible on Logging page, logs EVERY run import to show whether tickets were found and their resolved_at status, uses commit instead of flush to ensure persistence)
|
- Added debug logging to ticket linking function to troubleshoot resolved ticket propagation issues (writes to AuditLog table with event_type "ticket_link_debug", visible on Logging page, logs EVERY run import to show whether tickets were found and their resolved_at status, uses commit instead of flush to ensure persistence)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user