From 36f4717454f9da8dff013d0387882c6633662faa Mon Sep 17 00:00:00 2001 From: Mo Tarbin Date: Sat, 6 Jul 2024 03:15:56 -0400 Subject: [PATCH] Group chore detail query by chore ID and last completed date --- internal/chore/repo/repository.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/chore/repo/repository.go b/internal/chore/repo/repository.go index 52fa4ab..51ebb2c 100644 --- a/internal/chore/repo/repository.go +++ b/internal/chore/repo/repository.go @@ -243,7 +243,7 @@ func (r *ChoreRepository) GetChoreDetailByID(c context.Context, choreID int, cir ) ) AS recent_history ON chores.id = recent_history.chore_id`). Where("chores.id = ? and chores.circle_id = ?", choreID, circleID). - Group("chores.id"). + Group("chores.id, recent_history.last_completed_date"). First(&choreDetail).Error; err != nil { return nil, err