Fix month close migration constraints
This commit is contained in:
1 parent
a760f423a4
commit
4f0020a61d
2 files changed
+19
-3
No files matched your search
@@ -2962,13 +2962,13 @@ app.post("/api/periods/:periodType/:period/close", requireUser, async (req, res)
|
||||
false AS ticket_closed
|
||||
FROM tickets t
|
||||
JOIN sessions s ON s.ticket_id = t.id
|
||||
WHERE s.started_at >= $2::timestamptz AND s.started_at < $3::timestamptz
|
||||
AND s.user_id = $4
|
||||
WHERE s.started_at >= $1::timestamptz AND s.started_at < $2::timestamptz
|
||||
AND s.user_id = $3
|
||||
GROUP BY t.id, t.ticket_number
|
||||
HAVING COUNT(*) FILTER (WHERE s.billing_status IS NULL) > 0
|
||||
ORDER BY t.ticket_number ASC;
|
||||
`,
|
||||
[period.start, period.startIso, period.endIso, userId]
|
||||
[period.startIso, period.endIso, userId]
|
||||
);
|
||||
|
||||
if (blockersResult.rows.length > 0) {
|
||||
|
||||
Reference in new issue
Block a user