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> { ): Promise<ActivitySummaryDto> {
const { start, end } = dayBounds(); const { start, end } = dayBounds();
const scope = assigneeWhere(actor); 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([ const [today, overdue, upcoming] = await Promise.all([
this.prisma.activity.findMany({ this.prisma.activity.findMany({
where: { where: {
@@ -109,8 +127,8 @@ export class ActivitiesService {
today: today.map((row) => this.toDto(row)), today: today.map((row) => this.toDto(row)),
overdue: overdue.map((row) => this.toDto(row)), overdue: overdue.map((row) => this.toDto(row)),
upcoming: upcoming.map((row) => this.toDto(row)), upcoming: upcoming.map((row) => this.toDto(row)),
todayCount: today.length, todayCount,
overdueCount: overdue.length, overdueCount,
}; };
} }
+1 -1
View File
@@ -279,7 +279,7 @@ async function refreshNotifs() {
async function loadActivityBadge() { async function loadActivityBadge() {
try { try {
const { data } = await api.get<ActivitySummaryDto>('/activities/summary'); const { data } = await api.get<ActivitySummaryDto>('/activities/summary');
activityBadge.value = data.todayCount + data.overdueCount; activityBadge.value = data.todayCount;
} catch { } catch {
activityBadge.value = 0; activityBadge.value = 0;
} }