Merge pull request 'Show calls in incidents highlighted' (#98) from inIncident into trunk
Reviewed-on: #98
This commit is contained in:
commit
aabc383678
6 changed files with 27 additions and 21 deletions
|
@ -4,6 +4,5 @@ export interface CallRecord {
|
|||
duration: number;
|
||||
system_id: number;
|
||||
tgid: number;
|
||||
system_name: string;
|
||||
tg_name: string;
|
||||
incidents: number; // in incident
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@
|
|||
</td>
|
||||
</ng-container>
|
||||
<tr mat-header-row *matHeaderRowDef="columns; sticky: true"></tr>
|
||||
<tr mat-row *matRowDef="let myRowData; columns: columns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: columns" [ngClass]="{'in-incident': row.incidents > 0}"></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="pagFoot">
|
||||
|
|
|
@ -96,3 +96,7 @@ form {
|
|||
.tagSelect {
|
||||
flex: 1 1 250px;
|
||||
}
|
||||
|
||||
.in-incident {
|
||||
background-color: rgb(59, 0, 59);
|
||||
}
|
||||
|
|
|
@ -391,7 +391,10 @@ export class CallsComponent {
|
|||
}
|
||||
this.incSvc
|
||||
.addRemoveCalls(res, <CallIncidentParams>{
|
||||
add: this.selection.selected.map((s) => s.id),
|
||||
add: this.selection.selected.map((s, i, a) => {
|
||||
s.incidents++;
|
||||
return s.id;
|
||||
}),
|
||||
})
|
||||
.subscribe({
|
||||
next: () => {
|
||||
|
|
|
@ -255,13 +255,13 @@ SELECT
|
|||
c.id,
|
||||
c.call_date,
|
||||
c.duration,
|
||||
tgs.system_id,
|
||||
tgs.tgid,
|
||||
sys.name system_name,
|
||||
tgs.name tg_name
|
||||
c.system system_id,
|
||||
c.talkgroup tgid,
|
||||
COUNT(ic.incident_id) incidents
|
||||
FROM calls c
|
||||
JOIN talkgroups tgs ON c.talkgroup = tgs.tgid AND c.system = tgs.system_id
|
||||
JOIN systems sys ON sys.id = tgs.system_id
|
||||
LEFT JOIN incidents_calls ic ON c.id = ic.calls_tbl_id AND c.call_date = ic.call_date
|
||||
WHERE
|
||||
CASE WHEN $1::TIMESTAMPTZ IS NOT NULL THEN
|
||||
c.call_date >= $1 ELSE TRUE END AND
|
||||
|
@ -279,6 +279,7 @@ CASE WHEN $4::TEXT[] IS NOT NULL THEN
|
|||
(CASE WHEN $6::NUMERIC IS NOT NULL THEN (
|
||||
c.duration > $6
|
||||
) ELSE TRUE END)
|
||||
GROUP BY c.id, c.call_date
|
||||
ORDER BY
|
||||
CASE WHEN $7::TEXT = 'asc' THEN c.call_date END ASC,
|
||||
CASE WHEN $7 = 'desc' THEN c.call_date END DESC
|
||||
|
@ -299,13 +300,12 @@ type ListCallsPParams struct {
|
|||
}
|
||||
|
||||
type ListCallsPRow struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
CallDate pgtype.Timestamptz `json:"call_date"`
|
||||
Duration *int32 `json:"duration"`
|
||||
SystemID int32 `json:"system_id"`
|
||||
TGID int32 `json:"tgid"`
|
||||
SystemName string `json:"system_name"`
|
||||
TGName *string `json:"tg_name"`
|
||||
ID uuid.UUID `json:"id"`
|
||||
CallDate pgtype.Timestamptz `json:"call_date"`
|
||||
Duration *int32 `json:"duration"`
|
||||
SystemID int `json:"system_id"`
|
||||
TGID int `json:"tgid"`
|
||||
Incidents int64 `json:"incidents"`
|
||||
}
|
||||
|
||||
func (q *Queries) ListCallsP(ctx context.Context, arg ListCallsPParams) ([]ListCallsPRow, error) {
|
||||
|
@ -333,8 +333,7 @@ func (q *Queries) ListCallsP(ctx context.Context, arg ListCallsPParams) ([]ListC
|
|||
&i.Duration,
|
||||
&i.SystemID,
|
||||
&i.TGID,
|
||||
&i.SystemName,
|
||||
&i.TGName,
|
||||
&i.Incidents,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -101,13 +101,13 @@ SELECT
|
|||
c.id,
|
||||
c.call_date,
|
||||
c.duration,
|
||||
tgs.system_id,
|
||||
tgs.tgid,
|
||||
sys.name system_name,
|
||||
tgs.name tg_name
|
||||
c.system system_id,
|
||||
c.talkgroup tgid,
|
||||
COUNT(ic.incident_id) incidents
|
||||
FROM calls c
|
||||
JOIN talkgroups tgs ON c.talkgroup = tgs.tgid AND c.system = tgs.system_id
|
||||
JOIN systems sys ON sys.id = tgs.system_id
|
||||
LEFT JOIN incidents_calls ic ON c.id = ic.calls_tbl_id AND c.call_date = ic.call_date
|
||||
WHERE
|
||||
CASE WHEN sqlc.narg('start')::TIMESTAMPTZ IS NOT NULL THEN
|
||||
c.call_date >= @start ELSE TRUE END AND
|
||||
|
@ -125,6 +125,7 @@ CASE WHEN sqlc.narg('tags_not')::TEXT[] IS NOT NULL THEN
|
|||
(CASE WHEN sqlc.narg('longer_than')::NUMERIC IS NOT NULL THEN (
|
||||
c.duration > @longer_than
|
||||
) ELSE TRUE END)
|
||||
GROUP BY c.id, c.call_date
|
||||
ORDER BY
|
||||
CASE WHEN @direction::TEXT = 'asc' THEN c.call_date END ASC,
|
||||
CASE WHEN @direction = 'desc' THEN c.call_date END DESC
|
||||
|
|
Loading…
Reference in a new issue