Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions server/src/yemot-handler.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export class YemotHandlerService extends BaseYemotHandlerService {
override async processCall(): Promise<void> {
await this.getUserByDidPhone();
this.logger.log(`Processing call with ID: ${this.call.callId} from phone: ${this.call.phone}`);
if (await this.isPastReportingDeadline()) {
await this.hangupWithMessage("המערכת סגורה. לא ניתן לדווח אחרי השעה תשע וחצי בבוקר. המשך יום טוב.");
return;
}
const student = await this.getStudentByInput()
if (!student) return;
const alreadyReported = await this.hasReportedToday(student.id);
Expand All @@ -34,7 +38,15 @@ export class YemotHandlerService extends BaseYemotHandlerService {
await this.hangupWithMessage("יצאת מאוחר מידי המשך יום טוב");
}
}
private isPastReportingDeadline(): boolean {
const now = new Date();
const israelTime = new Date(now.toLocaleString('en-US', { timeZone: 'Asia/Jerusalem' }));

const hour = israelTime.getHours();
const minute = israelTime.getMinutes();

return hour > 9 || (hour === 9 && minute >= 30);
}
private async getStudentByInput(): Promise<Student> {
let student = null;
while (!student) {
Expand Down
Loading