From 914e2f82b0edfef0fe3a25086e530350dc626579 Mon Sep 17 00:00:00 2001 From: Trey t Date: Tue, 23 Dec 2025 17:50:49 -0600 Subject: [PATCH] Fix residence overdue count to exclude in-progress tasks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GetOverdueCountByResidence now uses ScopeNotInProgress to match the kanban overdue column behavior. This ensures the overdue count shown on residence cards matches what's displayed in the task board. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- internal/repositories/task_repo.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/repositories/task_repo.go b/internal/repositories/task_repo.go index 6335446..a7c3967 100644 --- a/internal/repositories/task_repo.go +++ b/internal/repositories/task_repo.go @@ -635,6 +635,7 @@ func (r *TaskRepository) FindCompletionImageByID(id uint) (*models.TaskCompletio // GetOverdueCountByResidence returns a map of residence ID to overdue task count. // Uses the task.scopes package for consistent filtering logic. +// Excludes in-progress tasks to match what's displayed in the kanban overdue column. // The `now` parameter should be the start of day in the user's timezone for accurate overdue detection. func (r *TaskRepository) GetOverdueCountByResidence(residenceIDs []uint, now time.Time) (map[uint]int, error) { if len(residenceIDs) == 0 { @@ -650,7 +651,7 @@ func (r *TaskRepository) GetOverdueCountByResidence(residenceIDs []uint, now tim err := r.db.Model(&models.Task{}). Select("residence_id, COUNT(*) as count"). - Scopes(task.ScopeForResidences(residenceIDs), task.ScopeOverdue(now)). + Scopes(task.ScopeForResidences(residenceIDs), task.ScopeOverdue(now), task.ScopeNotInProgress). Group("residence_id"). Scan(&results).Error if err != nil {