-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor add command for frequent expense and frequent income #183
Refactor add command for frequent expense and frequent income #183
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -47,7 +52,8 @@ public CommandResult execute(Model model) throws CommandException { | |||
} catch (DuplicateFrequentTransactionException e) { | |||
throw new CommandException(e.getMessage()); | |||
} | |||
return new CommandResult(String.format(MESSAGE_SUCCESS, toAdd)); | |||
Tab tabToSwitchTo = Tab.values()[EXPENSE_TAB_INDEX.getZeroBased()]; | |||
return new CommandResult(String.format(MESSAGE_SUCCESS, toAdd), tabToSwitchTo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return new CommandResult(String.format(MESSAGE_SUCCESS, toAdd), tabToSwitchTo); | |
return new CommandResult(String.format(MESSAGE_SUCCESS, toAdd), Tab.EXPENSES); |
Same for AddFrequentIncomeCommand
as well.
This will remove the need to have an Index
field to specify which Tab
to switch to.
Codecov Report
@@ Coverage Diff @@
## master #183 +/- ##
=========================================
Coverage 73.66% 73.66%
Complexity 787 787
=========================================
Files 129 129
Lines 2442 2442
Branches 254 254
=========================================
Hits 1799 1799
Misses 547 547
Partials 96 96
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Resolves #182.
Changes:
CommandResult
upon creating a newAddFrequentExpenseCommand
. The newCommandResult
contains the index of theExpense Tab
to switch to.CommandResult
upon creating a newAddFrequentIncomeCommand
. The newCommandResult
contains the index of theIncome Tab
to switch to.