fix: call time stop when time is more than estimation
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
1692c8234a
commit
551bd12f5b
|
@ -17,8 +17,7 @@ export function phoneNumberOnly(phone: string): string {
|
|||
export function timeIsBefore(
|
||||
currentTime: number,
|
||||
time: number,
|
||||
diff = 15,
|
||||
diffInMilliseconds: number,
|
||||
): boolean {
|
||||
const diffInMilliseconds = diff * 60 * 1000;
|
||||
return time < currentTime + diffInMilliseconds;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
} from 'src/core/strings/constants/base.constants';
|
||||
import { QueueTimeFormula } from './usecases/formula/queue-time.formula';
|
||||
import * as moment from 'moment';
|
||||
import { timeIsBefore, toTime } from './helpers/time.helper';
|
||||
import { timeIsBefore } from './helpers/time.helper';
|
||||
import { WhatsappService } from 'src/services/whatsapp/whatsapp.service';
|
||||
import { WhatsappQueue } from 'src/services/whatsapp/entity/whatsapp-queue.entity';
|
||||
|
||||
|
@ -63,11 +63,12 @@ export class QueueAdminOrchestrator {
|
|||
for (const queueId in queueTimes) {
|
||||
const callTime = queueTimes[queueId];
|
||||
|
||||
const queueTicket = await this.service.queueTicket(queueId);
|
||||
if (
|
||||
queueItem.requiring_notification ||
|
||||
timeIsBefore(currentTime, callTime, queueItem.call_preparation)
|
||||
(timeIsBefore(currentTime, callTime, call_preparation) &&
|
||||
queueTicket.time > currentTime)
|
||||
) {
|
||||
const queueTicket = await this.service.queueTicket(queueId);
|
||||
const payload: WhatsappQueue = {
|
||||
id: queueId,
|
||||
phone: queueTicket.item.ticket.phone,
|
||||
|
|
Loading…
Reference in New Issue