mirror of
https://github.com/abhinavxd/libredesk.git
synced 2026-09-23 19:06:35 +00:00
fix sql query
This commit is contained in:
@@ -75,9 +75,9 @@ SET next_sla_deadline_at = CASE
|
||||
-- If resolved or closed, clear the deadline
|
||||
WHEN c.status_id IN (SELECT id FROM conversation_statuses WHERE name IN ('Resolved', 'Closed')) THEN NULL
|
||||
|
||||
-- If an external timestamp ($3) is provided (e.g. next_response), use the earliest of $3.
|
||||
WHEN $3 IS NOT NULL THEN LEAST(
|
||||
$3::TIMESTAMPTZ,
|
||||
-- If an external timestamp ($2) is provided (e.g. next_response), use the earliest of $2.
|
||||
WHEN $2::TIMESTAMPTZ IS NOT NULL THEN LEAST(
|
||||
$2::TIMESTAMPTZ,
|
||||
CASE
|
||||
WHEN c.first_reply_at IS NOT NULL AND c.resolved_at IS NULL AND a.resolution_deadline_at IS NOT NULL THEN a.resolution_deadline_at
|
||||
WHEN c.first_reply_at IS NULL AND c.resolved_at IS NULL AND a.first_response_deadline_at IS NOT NULL THEN a.first_response_deadline_at
|
||||
@@ -86,7 +86,7 @@ SET next_sla_deadline_at = CASE
|
||||
END
|
||||
)
|
||||
|
||||
-- No $3,
|
||||
-- No $2,
|
||||
ELSE CASE
|
||||
WHEN c.first_reply_at IS NOT NULL AND c.resolved_at IS NULL AND a.resolution_deadline_at IS NOT NULL THEN a.resolution_deadline_at
|
||||
WHEN c.first_reply_at IS NULL AND c.resolved_at IS NULL AND a.first_response_deadline_at IS NOT NULL THEN a.first_response_deadline_at
|
||||
|
||||
Reference in New Issue
Block a user