From 712f974bb7470dc03f9515a6beb0ae993c6bc2d7 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 17 Aug 2019 03:56:22 -0400 Subject: remove reconciled transactions from the lists --- src/views/txn_table.rs | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/views/txn_table.rs b/src/views/txn_table.rs index 007b4e2..1a86c1e 100644 --- a/src/views/txn_table.rs +++ b/src/views/txn_table.rs @@ -151,7 +151,39 @@ fn txn_table( s.add_layer(cursive::views::Dialog::info(format!( "Successfully updated {} transactions", txns.len() - ))) + ))); + s.call_on_id("outflows_table", |v: &mut TxnTableView| { + let all_txns = v.borrow_items_mut(); + for id in txns.iter().map(|t| t.id.clone()) { + if let Some(idx) = + all_txns.iter().position(|t| t.id == id) + { + all_txns.remove(idx); + } + } + if let Some(row) = v.row() { + if row >= v.len() { + v.set_selected_row(v.len() - 1); + } + } + }) + .unwrap(); + s.call_on_id("inflows_table", |v: &mut TxnTableView| { + let all_txns = v.borrow_items_mut(); + for id in txns.iter().map(|t| t.id.clone()) { + if let Some(idx) = + all_txns.iter().position(|t| t.id == id) + { + all_txns.remove(idx); + } + } + if let Some(row) = v.row() { + if row >= v.len() { + v.set_selected_row(v.len() - 1); + } + } + }) + .unwrap(); } } else { s.add_layer(cursive::views::Dialog::info(format!( -- cgit v1.2.3