Merge pull request 'Fix tag matching for calls' (#85) from incidentsUi into trunk

Reviewed-on: #85
This commit is contained in:
amigan 2024-12-27 14:25:42 -05:00
commit d9a04c04b4
3 changed files with 9 additions and 8 deletions

1
.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
*.sql linguist-language=SQL

View file

@ -201,9 +201,9 @@ CASE WHEN $1::TIMESTAMPTZ IS NOT NULL THEN
CASE WHEN $2::TIMESTAMPTZ IS NOT NULL THEN
c.call_date <= $2 ELSE TRUE END AND
CASE WHEN $3::TEXT[] IS NOT NULL THEN
tgs.tags @> ARRAY[$3] ELSE TRUE END AND
tgs.tags && ARRAY[$3] ELSE TRUE END AND
CASE WHEN $4::TEXT[] IS NOT NULL THEN
(NOT (tgs.tags @> ARRAY[$4])) ELSE TRUE END AND
(NOT (tgs.tags && ARRAY[$4])) ELSE TRUE END AND
(CASE WHEN $5::TEXT IS NOT NULL THEN (
tgs.tg_group ILIKE '%' || $5 || '%' OR
tgs.name ILIKE '%' || $5 || '%' OR
@ -255,9 +255,9 @@ CASE WHEN $1::TIMESTAMPTZ IS NOT NULL THEN
CASE WHEN $2::TIMESTAMPTZ IS NOT NULL THEN
c.call_date <= $2 ELSE TRUE END AND
CASE WHEN $3::TEXT[] IS NOT NULL THEN
tgs.tags @> ARRAY[$3] ELSE TRUE END AND
tgs.tags && ARRAY[$3] ELSE TRUE END AND
CASE WHEN $4::TEXT[] IS NOT NULL THEN
(NOT (tgs.tags @> ARRAY[$4])) ELSE TRUE END AND
(NOT (tgs.tags && ARRAY[$4])) ELSE TRUE END AND
(CASE WHEN $5::TEXT IS NOT NULL THEN (
tgs.tg_group ILIKE '%' || $5 || '%' OR
tgs.name ILIKE '%' || $5 || '%' OR

View file

@ -99,9 +99,9 @@ CASE WHEN sqlc.narg('start')::TIMESTAMPTZ IS NOT NULL THEN
CASE WHEN sqlc.narg('end')::TIMESTAMPTZ IS NOT NULL THEN
c.call_date <= sqlc.narg('end') ELSE TRUE END AND
CASE WHEN sqlc.narg('tags_any')::TEXT[] IS NOT NULL THEN
tgs.tags @> ARRAY[@tags_any] ELSE TRUE END AND
tgs.tags && ARRAY[@tags_any] ELSE TRUE END AND
CASE WHEN sqlc.narg('tags_not')::TEXT[] IS NOT NULL THEN
(NOT (tgs.tags @> ARRAY[@tags_not])) ELSE TRUE END AND
(NOT (tgs.tags && ARRAY[@tags_not])) ELSE TRUE END AND
(CASE WHEN sqlc.narg('tg_filter')::TEXT IS NOT NULL THEN (
tgs.tg_group ILIKE '%' || @tg_filter || '%' OR
tgs.name ILIKE '%' || @tg_filter || '%' OR
@ -128,9 +128,9 @@ CASE WHEN sqlc.narg('start')::TIMESTAMPTZ IS NOT NULL THEN
CASE WHEN sqlc.narg('end')::TIMESTAMPTZ IS NOT NULL THEN
c.call_date <= sqlc.narg('end') ELSE TRUE END AND
CASE WHEN sqlc.narg('tags_any')::TEXT[] IS NOT NULL THEN
tgs.tags @> ARRAY[@tags_any] ELSE TRUE END AND
tgs.tags && ARRAY[@tags_any] ELSE TRUE END AND
CASE WHEN sqlc.narg('tags_not')::TEXT[] IS NOT NULL THEN
(NOT (tgs.tags @> ARRAY[@tags_not])) ELSE TRUE END AND
(NOT (tgs.tags && ARRAY[@tags_not])) ELSE TRUE END AND
(CASE WHEN sqlc.narg('tg_filter')::TEXT IS NOT NULL THEN (
tgs.tg_group ILIKE '%' || @tg_filter || '%' OR
tgs.name ILIKE '%' || @tg_filter || '%' OR