From bf852ee1a873351debcbfe215e64d3bd735ab4cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Calder=C3=B3n?= Date: Mon, 1 May 2023 16:27:05 -0300 Subject: [PATCH] Change vote by rate --- src/app/rate_user.rs | 14 +++++++------- src/db.rs | 4 ++-- src/util.rs | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/app/rate_user.rs b/src/app/rate_user.rs index 68091ab6..195c616a 100644 --- a/src/app/rate_user.rs +++ b/src/app/rate_user.rs @@ -226,12 +226,12 @@ pub async fn update_user_reputation_action( reputation.total_rating = new_rating; } - // Check if the order is not voted by the message sender and in case update NIP + // Check if the order is not rated by the message sender and in case update NIP let order_to_check_ratings = crate::db::find_order_by_id(pool, order.id).await?; - // Check what vote status needs update - let update_seller_vote = seller_rating && !order_to_check_ratings.seller_sent_rate; - let update_buyer_vote = buyer_rating && !order_to_check_ratings.buyer_sent_rate; - if update_buyer_vote && update_seller_vote { + // Check what rate status needs update + let update_seller_rate = seller_rating && !order_to_check_ratings.seller_sent_rate; + let update_buyer_rate = buyer_rating && !order_to_check_ratings.buyer_sent_rate; + if update_buyer_rate && update_seller_rate { return Ok(()); }; @@ -239,8 +239,8 @@ pub async fn update_user_reputation_action( //Update db with vote flags update_user_rating_event( &counterpart, - update_buyer_vote, - update_seller_vote, + update_buyer_rate, + update_seller_rate, reputation.as_json().unwrap(), order.id, my_keys, diff --git a/src/db.rs b/src/db.rs index 2a5d317d..e3875075 100644 --- a/src/db.rs +++ b/src/db.rs @@ -229,7 +229,7 @@ pub async fn update_order_event_id_status( Ok(rows_affected > 0) } -pub async fn update_order_event_seller_vote( +pub async fn update_order_event_seller_rate( pool: &SqlitePool, order_id: Uuid, seller_sent_rate: bool, @@ -252,7 +252,7 @@ pub async fn update_order_event_seller_vote( Ok(rows_affected > 0) } -pub async fn update_order_event_buyer_vote( +pub async fn update_order_event_buyer_rate( pool: &SqlitePool, order_id: Uuid, buyer_sent_rate: bool, diff --git a/src/util.rs b/src/util.rs index c7acea71..a2666fc6 100644 --- a/src/util.rs +++ b/src/util.rs @@ -135,10 +135,10 @@ pub async fn update_user_rating_event( info!("Sending replaceable event: {event:#?}"); // We update the order vote status if buyer_sent_rate { - crate::db::update_order_event_buyer_vote(pool, order_id, buyer_sent_rate).await?; + crate::db::update_order_event_buyer_rate(pool, order_id, buyer_sent_rate).await?; } if seller_sent_rate { - crate::db::update_order_event_seller_vote(pool, order_id, seller_sent_rate).await?; + crate::db::update_order_event_seller_rate(pool, order_id, seller_sent_rate).await?; } // Send event to relay