-
Notifications
You must be signed in to change notification settings - Fork 10k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Count queue time up to
closedAt
on closed rooms (#29842)
Co-authored-by: Aleksander Nicacio da Silva <6494543+aleksandernsilva@users.noreply.github.com>
- Loading branch information
1 parent
5832be2
commit 470c29d
Showing
4 changed files
with
43 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"@rocket.chat/meteor": patch | ||
--- | ||
|
||
Fixed an issue causing `queue time` to be calculated from current time when a room was closed without being served. | ||
Now: | ||
- For served rooms: queue time = servedBy time - queuedAt | ||
- For not served, but open rooms = now - queuedAt | ||
- For not served and closed rooms = closedAt - queuedAt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
apps/meteor/client/views/omnichannel/directory/utils/formatQueuedAt.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { IOmnichannelRoom } from '@rocket.chat/core-typings'; | ||
import moment from 'moment'; | ||
|
||
export const formatQueuedAt = (room: IOmnichannelRoom) => { | ||
const { servedBy, closedAt, open, queuedAt, ts } = room || {}; | ||
const queueStartedAt = queuedAt || ts; | ||
|
||
// Room served | ||
if (servedBy) { | ||
return moment(servedBy.ts).from(moment(queueStartedAt), true); | ||
} | ||
|
||
// Room open and not served | ||
if (open) { | ||
return moment(queueStartedAt).fromNow(true); | ||
} | ||
|
||
// Room closed and not served | ||
if (closedAt && queueStartedAt) { | ||
return moment(closedAt).from(moment(queueStartedAt), true); | ||
} | ||
|
||
return ''; | ||
}; |