From e04dcc926d1b8e30c86c4378979737ca7a8b587b Mon Sep 17 00:00:00 2001 From: EntireTwix Date: Wed, 14 Jul 2021 00:31:14 -0700 Subject: [PATCH] :art: changed SetBal format to match that of ImpactBal() --- src/bank.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bank.cpp b/src/bank.cpp index 3088866..e9bce39 100644 --- a/src/bank.cpp +++ b/src/bank.cpp @@ -156,11 +156,7 @@ void Bank::ChangePassword(const std::string &name, const std::string &new_pass) } BankResponse Bank::SetBal(const std::string &name, uint32_t amount) noexcept { - if (!ValidUsername(name) || !users.modify_if(name, [amount](User &u) { u.balance = amount; })) - { - return {k404NotFound, "\"User not found\""}; - } - else + if (ValidUsername(name) && users.modify_if(name, [amount](User &u) { u.balance = amount; })) { #if CONSERVATIVE_DISK_SAVE #if MULTI_THREADED @@ -171,6 +167,10 @@ BankResponse Bank::SetBal(const std::string &name, uint32_t amount) noexcept #endif return {k204NoContent, std::nullopt}; //returns new balance } + else + { + return {k404NotFound, "\"User not found\""}; + } } BankResponse Bank::ImpactBal(const std::string &name, int64_t amount) noexcept {