Group chore detail query by chore ID and last completed date

This commit is contained in:
Mo Tarbin 2024-07-06 03:15:56 -04:00
parent 45e18c8edd
commit 36f4717454
1 changed files with 1 additions and 1 deletions

View File

@ -243,7 +243,7 @@ func (r *ChoreRepository) GetChoreDetailByID(c context.Context, choreID int, cir
) )
) AS recent_history ON chores.id = recent_history.chore_id`). ) AS recent_history ON chores.id = recent_history.chore_id`).
Where("chores.id = ? and chores.circle_id = ?", choreID, circleID). 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 { First(&choreDetail).Error; err != nil {
return nil, err return nil, err