fix(user): align profile inventory stats with held assets
Count only status=1 inventory in the admin user profile so the profile inventory metrics match the held-assets inventory list semantics.
This commit is contained in:
parent
dd1034dda8
commit
38edc9f324
@ -207,9 +207,7 @@ func (h *handler) GetUserProfile() core.HandlerFunc {
|
|||||||
LEFT JOIN orders o ON o.id = ui.order_id
|
LEFT JOIN orders o ON o.id = ui.order_id
|
||||||
LEFT JOIN user_item_cards uic ON uic.id = o.item_card_id
|
LEFT JOIN user_item_cards uic ON uic.id = o.item_card_id
|
||||||
LEFT JOIN system_item_cards sic ON sic.id = uic.card_id
|
LEFT JOIN system_item_cards sic ON sic.id = uic.card_id
|
||||||
WHERE ui.user_id = ? AND ui.status IN (1, 3)
|
WHERE ui.user_id = ? AND ui.status = 1
|
||||||
AND COALESCE(ui.remark, '') NOT LIKE '%%void%%'
|
|
||||||
AND NOT (ui.status = 3 AND (COALESCE(ui.remark, '') LIKE '%%redeemed_points%%' OR COALESCE(ui.remark, '') LIKE '%%batch_redeemed%%'))
|
|
||||||
`, userID).Scan(&is).Error
|
`, userID).Scan(&is).Error
|
||||||
rsp.CurrentAssets.InventoryCount = is.Count
|
rsp.CurrentAssets.InventoryCount = is.Count
|
||||||
rsp.CurrentAssets.InventoryValue = is.Value
|
rsp.CurrentAssets.InventoryValue = is.Value
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user