Fix revision count in `grid po show`
Adds filter to select only revisions of the same purchase order
when showing a purchase order. Previously, if versions of different
purchase orders had the same version ID, the revision count would
include all revisions of versions with that name.
@@ -121,8 +121,9 @@ impl<'a> PurchaseOrderStoreGetPurchaseOrderOperation
.into_boxed()
.select(purchase_order_version_revision::all_columns)
.filter(
- purchase_order_version_revision::version_id
- .eq(&v.version_id)
+ purchase_order_version_revision::purchase_order_uid
+ .eq(&purchase_order_uid)
+ .and(purchase_order_version_revision::version_id.eq(&v.version_id))
.and(
purchase_order_version_revision::end_commit_num.eq(MAX_COMMIT_NUM),
),
@@ -266,8 +267,9 @@ impl<'a> PurchaseOrderStoreGetPurchaseOrderOperation
.into_boxed()
.select(purchase_order_version_revision::all_columns)
.filter(
- purchase_order_version_revision::version_id
- .eq(&v.version_id)
+ purchase_order_version_revision::purchase_order_uid
+ .eq(&purchase_order_uid)
+ .and(purchase_order_version_revision::version_id.eq(&v.version_id))
.and(
purchase_order_version_revision::end_commit_num.eq(MAX_COMMIT_NUM),
),
