Skip to content

Commit 39f6a19

Browse files
committed
Handle undefined daysAfterBlock in reminders logic
Updated countDaysAfterBlock to return undefined instead of null when blockedDate is missing. Adjusted paymaster worker logic to check for undefined, ensuring reminders are sent only when daysAfterBlock is valid.
1 parent d3e82b2 commit 39f6a19

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/utils/payday.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ export function countDaysAfterPayday(date: Date, paidUntil: Date = null, isDebug
5757
*
5858
* @param workspace - workspace object
5959
*/
60-
export function countDaysAfterBlock(workspace: WorkspaceDBScheme): number {
60+
export function countDaysAfterBlock(workspace: WorkspaceDBScheme): number | undefined {
6161
if (!workspace.blockedDate) {
62-
return null;
62+
return;
6363
}
6464

6565
const expectedPayDay = new Date(workspace.blockedDate);

workers/paymaster/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ export default class PaymasterWorker extends Worker {
283283
*/
284284
if (workspace.isBlocked) {
285285
// Send reminders on certain days after block
286-
if (daysAfterBlock !== null && DAYS_AFTER_BLOCK_TO_REMIND.includes(daysAfterBlock)) {
286+
if (daysAfterBlock !== undefined && DAYS_AFTER_BLOCK_TO_REMIND.includes(daysAfterBlock)) {
287287
await this.sendBlockedWorkspaceReminders(workspace, daysAfterBlock);
288288
}
289289

0 commit comments

Comments
 (0)