Skip to content

Commit

Permalink
use user websocket session data to get online state fix #42
Browse files Browse the repository at this point in the history
  • Loading branch information
allgood committed Aug 14, 2024
1 parent 3d184bc commit 1c09b6f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/src/services/ReportService/DashbardDataService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default async function DashboardDataService(
select
c.name "companyName",
u.name "userName",
u.online "userOnline",
(select count(*) > 0 as online from "UserSocketSessions" tu where tu."userId" = tt."userId" and tu."active" is True) "userOnline",
w.name "whatsappName",
ct.name "contactName",
ct.number "contactNumber",
Expand Down Expand Up @@ -89,15 +89,15 @@ export default async function DashboardDataService(
coalesce(att."avgWaitTime", 0) "avgWaitTime",
att.tickets,
att.rating,
att.online,
(select count(*) > 0 as online from "UserSocketSessions" us where us."userId" = u.id and us."active" is True) online,
att."closeCount",
att."openCount"
from "Users" u
left join (
select
u1.id,
u1."name",
u1."online",
(select count(*) > 0 as online from "UserSocketSessions" us1 where us1."userId" = u1.id and us1."active" is True) "online",
avg(t."supportTime") "avgSupportTime",
avg(t."waitTime") "avgWaitTime",
count(t."id") tickets,
Expand Down

0 comments on commit 1c09b6f

Please sign in to comment.