From 5486a68f895fed5dbbbb2477c3d579eb3cb9758a Mon Sep 17 00:00:00 2001 From: creating2morrow Date: Sat, 2 Dec 2023 13:31:06 -0500 Subject: [PATCH] patch export info lookup outside of guard --- neveko-core/src/order.rs | 7 +------ neveko-gui/src/apps/market.rs | 9 +++++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/neveko-core/src/order.rs b/neveko-core/src/order.rs index decd83a..3261c2c 100644 --- a/neveko-core/src/order.rs +++ b/neveko-core/src/order.rs @@ -458,7 +458,6 @@ pub async fn transmit_sor_request( /// can be executed from the gui. pub async fn trigger_ship_request( contact: &String, - db_key: &String, jwp: &String, orid: &String, ) -> Order { @@ -477,9 +476,6 @@ pub async fn trigger_ship_request( } let unwrap_order: Order = order.unwrap(); backup(&unwrap_order); - let prefix = String::from(db_key); - utils::clear_gui_db(String::from(&prefix), String::from(orid)); - utils::write_gui_db(prefix, String::from(orid), String::from(orid)); unwrap_order } @@ -488,11 +484,10 @@ pub async fn d_trigger_ship_request( contact: &String, jwp: &String, orid: &String, - status: &String, ) -> Order { info!("executing d_trigger_ship_request"); // request shipment if the order status is MultisigComplete - let trigger = trigger_ship_request(contact, jwp, orid, status).await; + let trigger = trigger_ship_request(contact, jwp, orid).await; if trigger.status == order::StatusType::MulitsigComplete.value() { let ship_res = transmit_ship_request(contact, jwp, orid).await; if ship_res.is_err() { diff --git a/neveko-gui/src/apps/market.rs b/neveko-gui/src/apps/market.rs index 8d08487..5883195 100644 --- a/neveko-gui/src/apps/market.rs +++ b/neveko-gui/src/apps/market.rs @@ -627,10 +627,10 @@ impl eframe::App for MarketApp { if self.msig.completed_export && !self.msig.completed_shipping_request { ui.horizontal(|ui| { - let vendor_prefix = String::from(crate::GUI_OVL_DB_KEY); - let vendor = utils::search_gui_db(vendor_prefix, self.m_order.orid.clone()); ui.label("Request Shipping: \t"); if ui.button("Send").clicked() { + let vendor_prefix = String::from(crate::GUI_OVL_DB_KEY); + let vendor = utils::search_gui_db(vendor_prefix, self.m_order.orid.clone()); self.is_loading = true; let jwp = utils::search_gui_db( String::from(crate::GUI_JWP_DB_KEY), @@ -2058,6 +2058,7 @@ fn verify_order_wallet_funded( let order_id = String::from(orid); let l_contact = String::from(contact); tokio::spawn(async move { + log::info!("executing verify_order_wallet_funded"); let wallet_password = utils::empty_string(); monero::open_wallet(&order_id, &wallet_password).await; let _ = monero::refresh().await; @@ -2083,6 +2084,7 @@ fn verify_order_wallet_funded( let total = &order.quantity & &product.price; if pre_bal.result.balance < total { let _ = tx.send(false); + ctx.request_repaint(); return; } let _ = tx.send(true); @@ -2152,8 +2154,7 @@ fn shipping_req( let v_jwp = String::from(jwp); tokio::spawn(async move { log::info!("shipping order req: {}", ship_orid); - let db_key: String = String::from(crate::GUI_OVL_DB_KEY); - let order = order::d_trigger_ship_request(&vendor_i2p, &db_key, &v_jwp, &ship_orid).await; + let order = order::d_trigger_ship_request(&vendor_i2p, &v_jwp, &ship_orid).await; let _ = tx.send(order); ctx.request_repaint(); });