From 829066fd871ee6d0841cae5dbee34a4b1f8bd707 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 18 Aug 2019 16:01:23 -0400 Subject: don't allow submitting without selected transactions --- src/views/txn_tables.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/txn_tables.rs b/src/views/txn_tables.rs index 8579bf6..eb0ae76 100644 --- a/src/views/txn_tables.rs +++ b/src/views/txn_tables.rs @@ -106,7 +106,7 @@ impl TxnTables { let total_outflow: i64 = outflows.iter().map(|t| t.amount).sum(); let total_amount = total_inflow + total_outflow; - if total_amount == 0 { + if total_amount == 0 && (inflows.len() + outflows.len() > 0) { let budget: &mut crate::ynab::Budget = s.user_data().unwrap(); let txns: Vec<_> = @@ -169,7 +169,7 @@ impl TxnTables { ) .unwrap(); } - } else { + } else if total_amount != 0 { s.add_layer(super::util::dialog(&format!( "Selected amount is {}, must be 0", crate::ynab::format_amount(total_amount) -- cgit v1.2.3