feat: implement requiring call notification
parent
44e74de315
commit
66720c5b8b
|
@ -57,12 +57,16 @@ export class QueueAdminOrchestrator {
|
||||||
|
|
||||||
for (const queueItem of itemMasters) {
|
for (const queueItem of itemMasters) {
|
||||||
const queueTimes = await this.queueTimeFormula.items(queueItem.id);
|
const queueTimes = await this.queueTimeFormula.items(queueItem.id);
|
||||||
|
const call_preparation = queueItem.call_preparation * 60 * 1000;
|
||||||
if (!queueItem.use_notification) continue;
|
if (!queueItem.use_notification) continue;
|
||||||
|
|
||||||
for (const queueId in queueTimes) {
|
for (const queueId in queueTimes) {
|
||||||
const callTime = queueTimes[queueId];
|
const callTime = queueTimes[queueId];
|
||||||
|
|
||||||
if (timeIsBefore(currentTime, callTime, queueItem.call_preparation)) {
|
if (
|
||||||
|
queueItem.requiring_notification ||
|
||||||
|
timeIsBefore(currentTime, callTime, queueItem.call_preparation)
|
||||||
|
) {
|
||||||
const queueTicket = await this.service.queueTicket(queueId);
|
const queueTicket = await this.service.queueTicket(queueId);
|
||||||
const payload: WhatsappQueue = {
|
const payload: WhatsappQueue = {
|
||||||
id: queueId,
|
id: queueId,
|
||||||
|
@ -76,11 +80,10 @@ export class QueueAdminOrchestrator {
|
||||||
console.log({
|
console.log({
|
||||||
currentTime: toTime(currentTime),
|
currentTime: toTime(currentTime),
|
||||||
callTime: toTime(callTime),
|
callTime: toTime(callTime),
|
||||||
last_notification: toTime(queueTicket.last_notification),
|
lastNotification: toTime(queueTicket.last_notification),
|
||||||
queueId,
|
code: queueTicket.code,
|
||||||
});
|
});
|
||||||
|
|
||||||
const call_preparation = queueItem.call_preparation * 60 * 1000;
|
|
||||||
if (queueTicket.last_notification < currentTime - call_preparation) {
|
if (queueTicket.last_notification < currentTime - call_preparation) {
|
||||||
await notification.queueProcess(payload);
|
await notification.queueProcess(payload);
|
||||||
this.service.updateLastNotification(queueId, currentTime);
|
this.service.updateLastNotification(queueId, currentTime);
|
||||||
|
|
Loading…
Reference in New Issue