From 9c488cdc3c98816de750f758ced66e7fddacfabb Mon Sep 17 00:00:00 2001 From: cavidelizade Date: Fri, 17 Jul 2026 00:59:53 +0400 Subject: [PATCH] fix(api): exclude removed issues from module progress StateDistributionByProject is a raw query, so GORM doesn't inject the soft-delete scope, and it was missing AND mi.deleted_at IS NULL. Issues removed from a module (a soft delete on module_issues) still counted toward its progress totals. The cycle equivalent already filters this; match it. Closes #343 Co-Authored-By: Claude Opus 4.8 (1M context) --- apps/api/internal/store/module.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/internal/store/module.go b/apps/api/internal/store/module.go index 8c17e47..73fce76 100644 --- a/apps/api/internal/store/module.go +++ b/apps/api/internal/store/module.go @@ -184,7 +184,7 @@ func (s *ModuleStore) StateDistributionByProject(ctx context.Context, projectID FROM module_issues mi JOIN issues i ON i.id = mi.issue_id AND i.deleted_at IS NULL LEFT JOIN states st ON st.id = i.state_id - WHERE mi.project_id = ? + WHERE mi.project_id = ? AND mi.deleted_at IS NULL GROUP BY mi.module_id, COALESCE(st."group", 'backlog') `, projectID).Scan(&rows).Error if err != nil {