aboutsummaryrefslogtreecommitdiffstats
path: root/src/views/txn_tables.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-08-18 16:01:23 -0400
committerJesse Luehrs <doy@tozt.net>2019-08-18 16:02:10 -0400
commit829066fd871ee6d0841cae5dbee34a4b1f8bd707 (patch)
treee8e665b3b8425058489432ffb0f4e742e91f417d /src/views/txn_tables.rs
parentd42001eedf861e7063c619851f16c98b5514c8fc (diff)
downloadynab-api-829066fd871ee6d0841cae5dbee34a4b1f8bd707.tar.gz
ynab-api-829066fd871ee6d0841cae5dbee34a4b1f8bd707.zip
don't allow submitting without selected transactions
Diffstat (limited to 'src/views/txn_tables.rs')
-rw-r--r--src/views/txn_tables.rs4
1 files 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)