Fixing the error in today's task count

This commit is contained in:
2026-10-06 12:44:09 +03:30
parent f71f09c85d
commit 0d7555f219
2 changed files with 21 additions and 3 deletions
+20 -2
View File
@@ -69,6 +69,24 @@ export class ActivitiesService {
): Promise<ActivitySummaryDto> {
const { start, end } = dayBounds();
const scope = assigneeWhere(actor);
const [todayCount, overdueCount] = await Promise.all([
this.prisma.activity.count({
where: {
organizationId,
...scope,
status: 'open',
dueAt: { gte: start, lt: end },
},
}),
this.prisma.activity.count({
where: {
organizationId,
...scope,
status: 'open',
dueAt: { lt: start },
},
}),
]);
const [today, overdue, upcoming] = await Promise.all([
this.prisma.activity.findMany({
where: {
@@ -109,8 +127,8 @@ export class ActivitiesService {
today: today.map((row) => this.toDto(row)),
overdue: overdue.map((row) => this.toDto(row)),
upcoming: upcoming.map((row) => this.toDto(row)),
todayCount: today.length,
overdueCount: overdue.length,
todayCount,
overdueCount,
};
}