Merge branch 'partmanIntvl115' of git.dynatron.me:amigan/stillbox into partmanIntvl115
This commit is contained in:
commit
5310780f05
5 changed files with 25 additions and 6 deletions
|
@ -204,6 +204,7 @@ type CallsParams struct {
|
||||||
TagsNot []string `json:"tagsNot"`
|
TagsNot []string `json:"tagsNot"`
|
||||||
TGFilter *string `json:"tgFilter"`
|
TGFilter *string `json:"tgFilter"`
|
||||||
AtLeastSeconds *float32 `json:"atLeastSeconds"`
|
AtLeastSeconds *float32 `json:"atLeastSeconds"`
|
||||||
|
UnknownTG bool `json:"unknownTG"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *postgresStore) Calls(ctx context.Context, p CallsParams) (rows []database.ListCallsPRow, totalCount int, err error) {
|
func (s *postgresStore) Calls(ctx context.Context, p CallsParams) (rows []database.ListCallsPRow, totalCount int, err error) {
|
||||||
|
@ -224,6 +225,7 @@ func (s *postgresStore) Calls(ctx context.Context, p CallsParams) (rows []databa
|
||||||
PerPage: perPage,
|
PerPage: perPage,
|
||||||
Direction: p.Direction.DirString(common.DirAsc),
|
Direction: p.Direction.DirString(common.DirAsc),
|
||||||
TGFilter: p.TGFilter,
|
TGFilter: p.TGFilter,
|
||||||
|
UnknownTG: p.UnknownTG,
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.AtLeastSeconds != nil {
|
if p.AtLeastSeconds != nil {
|
||||||
|
@ -245,6 +247,7 @@ func (s *postgresStore) Calls(ctx context.Context, p CallsParams) (rows []databa
|
||||||
TagsNot: par.TagsNot,
|
TagsNot: par.TagsNot,
|
||||||
TGFilter: par.TGFilter,
|
TGFilter: par.TGFilter,
|
||||||
LongerThan: par.LongerThan,
|
LongerThan: par.LongerThan,
|
||||||
|
UnknownTG: par.UnknownTG,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -319,6 +319,9 @@ CASE WHEN $4::TEXT[] IS NOT NULL THEN
|
||||||
) ELSE TRUE END) AND
|
) ELSE TRUE END) AND
|
||||||
(CASE WHEN $6::NUMERIC IS NOT NULL THEN (
|
(CASE WHEN $6::NUMERIC IS NOT NULL THEN (
|
||||||
c.duration > $6
|
c.duration > $6
|
||||||
|
) ELSE TRUE END) AND
|
||||||
|
(CASE WHEN $7::BOOLEAN = TRUE THEN (
|
||||||
|
tgs.tgid IS NULL
|
||||||
) ELSE TRUE END)
|
) ELSE TRUE END)
|
||||||
`
|
`
|
||||||
|
|
||||||
|
@ -329,6 +332,7 @@ type ListCallsCountParams struct {
|
||||||
TagsNot []string `json:"tagsNot"`
|
TagsNot []string `json:"tagsNot"`
|
||||||
TGFilter *string `json:"tgFilter"`
|
TGFilter *string `json:"tgFilter"`
|
||||||
LongerThan pgtype.Numeric `json:"longerThan"`
|
LongerThan pgtype.Numeric `json:"longerThan"`
|
||||||
|
UnknownTG bool `json:"unknownTg"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *Queries) ListCallsCount(ctx context.Context, arg ListCallsCountParams) (int64, error) {
|
func (q *Queries) ListCallsCount(ctx context.Context, arg ListCallsCountParams) (int64, error) {
|
||||||
|
@ -339,6 +343,7 @@ func (q *Queries) ListCallsCount(ctx context.Context, arg ListCallsCountParams)
|
||||||
arg.TagsNot,
|
arg.TagsNot,
|
||||||
arg.TGFilter,
|
arg.TGFilter,
|
||||||
arg.LongerThan,
|
arg.LongerThan,
|
||||||
|
arg.UnknownTG,
|
||||||
)
|
)
|
||||||
var count int64
|
var count int64
|
||||||
err := row.Scan(&count)
|
err := row.Scan(&count)
|
||||||
|
@ -374,13 +379,16 @@ CASE WHEN $4::TEXT[] IS NOT NULL THEN
|
||||||
) ELSE TRUE END) AND
|
) ELSE TRUE END) AND
|
||||||
(CASE WHEN $6::NUMERIC IS NOT NULL THEN (
|
(CASE WHEN $6::NUMERIC IS NOT NULL THEN (
|
||||||
c.duration > $6
|
c.duration > $6
|
||||||
|
) ELSE TRUE END) AND
|
||||||
|
(CASE WHEN $7::BOOLEAN = TRUE THEN (
|
||||||
|
tgs.tgid IS NULL
|
||||||
) ELSE TRUE END)
|
) ELSE TRUE END)
|
||||||
GROUP BY c.id, c.call_date
|
GROUP BY c.id, c.call_date
|
||||||
ORDER BY
|
ORDER BY
|
||||||
CASE WHEN $7::TEXT = 'asc' THEN c.call_date END ASC,
|
CASE WHEN $8::TEXT = 'asc' THEN c.call_date END ASC,
|
||||||
CASE WHEN $7 = 'desc' THEN c.call_date END DESC
|
CASE WHEN $8 = 'desc' THEN c.call_date END DESC
|
||||||
OFFSET $8 ROWS
|
OFFSET $9 ROWS
|
||||||
FETCH NEXT $9 ROWS ONLY
|
FETCH NEXT $10 ROWS ONLY
|
||||||
`
|
`
|
||||||
|
|
||||||
type ListCallsPParams struct {
|
type ListCallsPParams struct {
|
||||||
|
@ -390,6 +398,7 @@ type ListCallsPParams struct {
|
||||||
TagsNot []string `json:"tagsNot"`
|
TagsNot []string `json:"tagsNot"`
|
||||||
TGFilter *string `json:"tgFilter"`
|
TGFilter *string `json:"tgFilter"`
|
||||||
LongerThan pgtype.Numeric `json:"longerThan"`
|
LongerThan pgtype.Numeric `json:"longerThan"`
|
||||||
|
UnknownTG bool `json:"unknownTg"`
|
||||||
Direction string `json:"direction"`
|
Direction string `json:"direction"`
|
||||||
Offset int32 `json:"offset"`
|
Offset int32 `json:"offset"`
|
||||||
PerPage int32 `json:"perPage"`
|
PerPage int32 `json:"perPage"`
|
||||||
|
@ -413,6 +422,7 @@ func (q *Queries) ListCallsP(ctx context.Context, arg ListCallsPParams) ([]ListC
|
||||||
arg.TagsNot,
|
arg.TagsNot,
|
||||||
arg.TGFilter,
|
arg.TGFilter,
|
||||||
arg.LongerThan,
|
arg.LongerThan,
|
||||||
|
arg.UnknownTG,
|
||||||
arg.Direction,
|
arg.Direction,
|
||||||
arg.Offset,
|
arg.Offset,
|
||||||
arg.PerPage,
|
arg.PerPage,
|
||||||
|
|
|
@ -203,7 +203,7 @@ FROM incidents_calls ic, LATERAL (
|
||||||
sc.audio_url,
|
sc.audio_url,
|
||||||
sc.frequency,
|
sc.frequency,
|
||||||
sc.frequencies,
|
sc.frequencies,
|
||||||
c.talker_alias,
|
sc.talker_alias,
|
||||||
sc.patches,
|
sc.patches,
|
||||||
sc.source,
|
sc.source,
|
||||||
sc.transcript
|
sc.transcript
|
||||||
|
|
|
@ -127,6 +127,9 @@ CASE WHEN sqlc.narg('tags_not')::TEXT[] IS NOT NULL THEN
|
||||||
) ELSE TRUE END) AND
|
) ELSE TRUE END) AND
|
||||||
(CASE WHEN sqlc.narg('longer_than')::NUMERIC IS NOT NULL THEN (
|
(CASE WHEN sqlc.narg('longer_than')::NUMERIC IS NOT NULL THEN (
|
||||||
c.duration > @longer_than
|
c.duration > @longer_than
|
||||||
|
) ELSE TRUE END) AND
|
||||||
|
(CASE WHEN @unknown_tg::BOOLEAN = TRUE THEN (
|
||||||
|
tgs.tgid IS NULL
|
||||||
) ELSE TRUE END)
|
) ELSE TRUE END)
|
||||||
GROUP BY c.id, c.call_date
|
GROUP BY c.id, c.call_date
|
||||||
ORDER BY
|
ORDER BY
|
||||||
|
@ -157,6 +160,9 @@ CASE WHEN sqlc.narg('tags_not')::TEXT[] IS NOT NULL THEN
|
||||||
) ELSE TRUE END) AND
|
) ELSE TRUE END) AND
|
||||||
(CASE WHEN sqlc.narg('longer_than')::NUMERIC IS NOT NULL THEN (
|
(CASE WHEN sqlc.narg('longer_than')::NUMERIC IS NOT NULL THEN (
|
||||||
c.duration > @longer_than
|
c.duration > @longer_than
|
||||||
|
) ELSE TRUE END) AND
|
||||||
|
(CASE WHEN @unknown_tg::BOOLEAN = TRUE THEN (
|
||||||
|
tgs.tgid IS NULL
|
||||||
) ELSE TRUE END)
|
) ELSE TRUE END)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ FROM incidents_calls ic, LATERAL (
|
||||||
sc.audio_url,
|
sc.audio_url,
|
||||||
sc.frequency,
|
sc.frequency,
|
||||||
sc.frequencies,
|
sc.frequencies,
|
||||||
c.talker_alias,
|
sc.talker_alias,
|
||||||
sc.patches,
|
sc.patches,
|
||||||
sc.source,
|
sc.source,
|
||||||
sc.transcript
|
sc.transcript
|
||||||
|
|
Loading…
Add table
Reference in a new issue