diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-08-17 03:56:22 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-08-17 03:56:22 -0400 |
commit | 712f974bb7470dc03f9515a6beb0ae993c6bc2d7 (patch) | |
tree | db675446c28f794d132ad6a1022762bcbe9ed909 | |
parent | 39b10acb918ca059384c620d38e31c669f6696b2 (diff) | |
download | ynab-api-712f974bb7470dc03f9515a6beb0ae993c6bc2d7.tar.gz ynab-api-712f974bb7470dc03f9515a6beb0ae993c6bc2d7.zip |
remove reconciled transactions from the lists
-rw-r--r-- | src/views/txn_table.rs | 34 |
1 files changed, 33 insertions, 1 deletions
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!( |