From 9c91df6d2e8df6c0c1f929cefb8dc68ca9fe4ec1 Mon Sep 17 00:00:00 2001 From: jake Date: Thu, 12 Nov 2020 23:47:21 -0700 Subject: [PATCH] fix mags --- src/entity/gateway/postgres/postgres.rs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/entity/gateway/postgres/postgres.rs b/src/entity/gateway/postgres/postgres.rs index 9b41d15..00de8ba 100644 --- a/src/entity/gateway/postgres/postgres.rs +++ b/src/entity/gateway/postgres/postgres.rs @@ -450,16 +450,20 @@ impl EntityGateway for PostgresGateway { let entity = sqlx::query_as::<_, PgItemWithLocation>("select item.id, item.item, item_location.location from item join item_location on item.id = item_location.item where id = $1") .bind(item) .fetch_one(&self.pool).await - .map(|item| item.into())?; + .map(|item| item.into()) + .map(|item| self.apply_item_modifications(item))? + .await; real_inventory.push(InventoryItemEntity::Individual(entity)); }, PgInventoryItemEntity::Stacked(items) => { let mut stacked_item = Vec::new(); for s_item in items { stacked_item.push(sqlx::query_as::<_, PgItemWithLocation>("select item.id, item.item, item_location.location from item join item_location on item.id = item_location.item where id = $1") - .bind(s_item) - .fetch_one(&self.pool).await - .map(|item| item.into())?) + .bind(s_item) + .fetch_one(&self.pool).await + .map(|item| item.into()) + .map(|item| self.apply_item_modifications(item))? + .await) } real_inventory.push(InventoryItemEntity::Stacked(stacked_item)); } @@ -482,16 +486,20 @@ impl EntityGateway for PostgresGateway { let entity = sqlx::query_as::<_, PgItemWithLocation>("select item.id, item.item, item_location.location from item join item_location on item.id = item_location.item where id = $1") .bind(item) .fetch_one(&self.pool).await - .map(|item| item.into())?; + .map(|item| item.into()) + .map(|item| self.apply_item_modifications(item))? + .await; real_bank.push(BankItemEntity::Individual(entity)); }, PgInventoryItemEntity::Stacked(items) => { let mut stacked_item = Vec::new(); for s_item in items { stacked_item.push(sqlx::query_as::<_, PgItemWithLocation>("select item.id, item.item, item_location.location from item join item_location on item.id = item_location.item where id = $1") - .bind(s_item) - .fetch_one(&self.pool).await - .map(|item| item.into())?) + .bind(s_item) + .fetch_one(&self.pool).await + .map(|item| item.into()) + .map(|item| self.apply_item_modifications(item))? + .await) } real_bank.push(BankItemEntity::Stacked(stacked_item)); }