mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage-server
synced 2026-04-11 10:07:22 +00:00
fix: use HH:MM:SS format for Ozonetel abandonCalls time params
Ozonetel API expects time-of-day format (HH:MM:SS), not full datetime. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -37,13 +37,14 @@ export class MissedQueueService implements OnModuleInit {
|
||||
let created = 0;
|
||||
let updated = 0;
|
||||
|
||||
// Ozonetel fromTime/toTime use HH:MM:SS format (time of day, filters within current day)
|
||||
const now = new Date();
|
||||
const fiveMinAgo = new Date(now.getTime() - 5 * 60 * 1000);
|
||||
const format = (d: Date) => d.toISOString().replace('T', ' ').slice(0, 19);
|
||||
const toHHMMSS = (d: Date) => d.toTimeString().slice(0, 8);
|
||||
|
||||
let abandonCalls: any[];
|
||||
try {
|
||||
abandonCalls = await this.ozonetel.getAbandonCalls({ fromTime: format(fiveMinAgo), toTime: format(now) });
|
||||
abandonCalls = await this.ozonetel.getAbandonCalls({ fromTime: toHHMMSS(fiveMinAgo), toTime: toHHMMSS(now) });
|
||||
} catch (err) {
|
||||
this.logger.warn(`Failed to fetch abandon calls: ${err}`);
|
||||
return { created: 0, updated: 0 };
|
||||
|
||||
Reference in New Issue
Block a user