Skip to content

Commit f936f61

Browse files
committed
fix: ignore empty jobs
1 parent b4e3c71 commit f936f61

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

backend/src/record/recurrent-record/recurrent-record.service.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,18 @@ export class RecurrentRecordService {
200200
const date = dayjs(invocation.nextInvocation);
201201
return date.month() === month && date.year() === year;
202202
});
203-
return nextInvocationsInMonth.map((invocation) => {
204-
const record = records.find((record) => record.id === invocation.id);
205-
return {
206-
...record,
207-
periodicity: record.periodicity as Periodicity,
208-
nextInvocation: invocation.nextInvocation,
209-
};
210-
});
203+
return nextInvocationsInMonth
204+
.map((invocation) => {
205+
const record = records.find((record) => record.id === invocation.id);
206+
if (record) {
207+
return {
208+
...record,
209+
periodicity: record.periodicity as Periodicity,
210+
nextInvocation: invocation.nextInvocation,
211+
};
212+
}
213+
})
214+
.filter((record) => !!record);
211215
}
212216
}
213217

0 commit comments

Comments
 (0)