Skip to content

Commit

Permalink
fix: ignore time in timestamp comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-wasmeier-titanom committed May 21, 2024
1 parent 3c2d908 commit 891458c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/src/db/functions/assignment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export async function dbGetCurrentAssignmentsForTaskGroup(taskGroupId: number) {
.innerJoin(taskTable, eq(taskTable.id, assignmentTable.taskId))
.innerJoin(taskGroupTable, eq(taskGroupTable.id, taskTable.taskGroupId))
.where(
sql`${assignmentTable.createdAt} >= NOW() - ${taskGroupTable.interval} AND ${taskGroupTable.id} = ${taskGroupId}`,
sql`${assignmentTable.createdAt}::date >= NOW()::date - ${taskGroupTable.interval} AND ${taskGroupTable.id} = ${taskGroupId}`,
);

return currentAssignments;
Expand All @@ -94,7 +94,7 @@ export async function dbGetTasksToAssignForCurrentInterval() {
.having(
or(
eq(count(assignmentTable.id), 0),
sql`MAX(${assignmentTable.createdAt}) <= (NOW() - ${taskGroupTable.interval})`,
sql`MAX(${assignmentTable.createdAt})::date <= (NOW()::date - ${taskGroupTable.interval})`,
),
);

Expand Down

0 comments on commit 891458c

Please sign in to comment.