From ac60034484022d8240222046991f17099e76682d Mon Sep 17 00:00:00 2001 From: romanskijdev Date: Tue, 25 Aug 2026 08:52:27 +0300 Subject: [PATCH] Add initiator approvals to daily reminder --- .../telegram_service/scheduler/daily_reminder.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/service/telegram_service/scheduler/daily_reminder.go b/service/telegram_service/scheduler/daily_reminder.go index 056cabc..4a9e0cc 100644 --- a/service/telegram_service/scheduler/daily_reminder.go +++ b/service/telegram_service/scheduler/daily_reminder.go @@ -140,6 +140,17 @@ func (dr *DailyReminder) sendReminderToUser(bot *tgbotapi.BotAPI, ctx context.Co } revisionsCount := len(revisions) + myPendingApprovals, _, err := dr.ipc.Database.Approval.GetApprovalsListDB(ctx, typescore.ListDbOptions{ + Filtering: &typescore.Approval{ + InitiatorID: &userID, + Status: utilscore.PointerToString("pending"), + }, + }) + if err != nil { + logrus.Errorf("DailyReminder: GetApprovalsListDB (my pending) for user=%d err=%v", userID, err) + } + myPendingCount := len(myPendingApprovals) + tasks, _, err := dr.ipc.Database.ApprovalTasks.GetApprovalTasksListDB(ctx, typescore.ListDbOptions{ Filtering: &typescore.ApprovalTask{ ExecutorID: &userID, @@ -174,7 +185,7 @@ func (dr *DailyReminder) sendReminderToUser(bot *tgbotapi.BotAPI, ctx context.Co approvalsCount := dr.countPendingApprovals(ctx, steps, additionalApprovers) - hasPersonalItems := revisionsCount > 0 || tasksCount > 0 || approvalsCount > 0 + hasPersonalItems := revisionsCount > 0 || tasksCount > 0 || approvalsCount > 0 || myPendingCount > 0 logrus.Infof("DailyReminder: userID=%d telegramID=%d — revisions=%d tasks=%d approvals=%d hasPersonalItems=%v absentTodayCount=%d", userID, telegramID, revisionsCount, tasksCount, approvalsCount, hasPersonalItems, len(absentToday)) @@ -186,6 +197,9 @@ func (dr *DailyReminder) sendReminderToUser(bot *tgbotapi.BotAPI, ctx context.Co text := "☀️ Доброе утро! Ежедневная сводка\n\n" + if myPendingCount > 0 { + text += fmt.Sprintf("Ваших заявок на согласовании: %d\n", myPendingCount) + } if revisionsCount > 0 { text += fmt.Sprintf("Заявок на доработке: %d\n", revisionsCount) } -- 2.43.0