Fixed incorrect sum of the total items price

https://github.com/hay-kot/homebox/issues/458
This commit is contained in:
Adamko 2023-07-27 20:29:14 +02:00 committed by Hayden
parent a9712c48af
commit e835c6cb3c
No known key found for this signature in database
GPG key ID: 17CF79474E257545

View file

@ -233,7 +233,7 @@ func (r *GroupRepository) StatsGroup(ctx context.Context, GID uuid.UUID) (GroupS
(SELECT COUNT(*) FROM items WHERE group_items = ? AND items.archived = false) AS total_items,
(SELECT COUNT(*) FROM locations WHERE group_locations = ?) AS total_locations,
(SELECT COUNT(*) FROM labels WHERE group_labels = ?) AS total_labels,
(SELECT SUM(purchase_price) FROM items WHERE group_items = ? AND items.archived = false) AS total_item_price,
(SELECT SUM(purchase_price*quantity) FROM items WHERE group_items = ? AND items.archived = false) AS total_item_price,
(SELECT COUNT(*)
FROM items
WHERE group_items = ?