Skip to content
Snippets Groups Projects
Unverified Commit e1059c13 authored by Murtaza Patrawala's avatar Murtaza Patrawala Committed by GitHub
Browse files

Regression: Fix Default Business hour overriding other Business Hours (#24288)

parent 1b44f2d3
No related branches found
No related tags found
No related merge requests found
......@@ -175,16 +175,21 @@ export class MultipleBusinessHoursBehavior extends AbstractBusinessHourBehavior
{ projection: { _id: 1, businessHourId: 1 } },
).toArray();
if (departmentsWithActiveBH.length) {
const activeBusinessHoursForAgent = departmentsWithActiveBH.map(({ businessHourId }) => businessHourId);
await this.UsersRepository.openAgentBusinessHoursByBusinessHourIdsAndAgentId(activeBusinessHoursForAgent, agentId);
if (!departmentsWithActiveBH.length) {
bhLogger.debug(
`Business hour status recheck passed for agentId: ${agentId}. Found following business hours to be active:`,
activeBusinessHoursForAgent,
`Business hour status recheck failed for agentId: ${agentId}. No opened business hour found for any of the departments connected to the agent`,
);
return true;
return false;
}
const activeBusinessHoursForAgent = departmentsWithActiveBH.map(({ businessHourId }) => businessHourId);
await this.UsersRepository.openAgentBusinessHoursByBusinessHourIdsAndAgentId(activeBusinessHoursForAgent, agentId);
bhLogger.debug(
`Business hour status recheck passed for agentId: ${agentId}. Found following business hours to be active:`,
activeBusinessHoursForAgent,
);
return true;
}
// check if default businessHour is active
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment