From d433273bf717f6230a46effd28b937c496f537d7 Mon Sep 17 00:00:00 2001 From: Noor Date: Fri, 20 Jun 2025 16:20:12 +0530 Subject: [PATCH] Minor fix on app node fields Remove offline_minutes from AppNodeWithReports and update query condition for active app node filter --- src/db/app.rs | 3 ++- surql/timer.sql | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/db/app.rs b/src/db/app.rs index 178a196..23544cc 100644 --- a/src/db/app.rs +++ b/src/db/app.rs @@ -231,7 +231,6 @@ pub struct AppNodeWithReports { pub avail_ports: u32, pub max_ports_per_app: u32, pub price: u64, - pub offline_minutes: u64, pub reports: Vec, } @@ -269,6 +268,8 @@ impl AppNodeWithReports { filter_query += &format!("&& ip = '{}' ", filters.ip); } + filter_query += " && connected_at > disconnected_at "; + if limit_one { filter_query += "limit 1"; } diff --git a/surql/timer.sql b/surql/timer.sql index fda6835..ca7408f 100644 --- a/surql/timer.sql +++ b/surql/timer.sql @@ -43,7 +43,7 @@ FOR $app_contract IN (select * from active_app fetch out) { LET $escrow_multiplier = IF $operator.escrow < 5_000_000_000_000 { 1 } ELSE { 5 }; IF $node_is_online { UPDATE $operator.id SET balance += $amount_paid * $escrow_multiplier; - UPDTE $app_contract.id SET + UPDATE $app_contract.id SET locked_nano -= $amount_paid, collected_at = time::now(); } ELSE {