From fdf211c2c7c64f2e1955a001881135da79ca926d Mon Sep 17 00:00:00 2001 From: Nicholas Lee Date: Mon, 3 Apr 2023 17:38:01 +0800 Subject: [PATCH 1/4] change address app names to fasttrack, fix recurring expense manager --- data/addressbook.json | 8 - data/fastTrack.json | 229 ++++++++++++++++++ docs/tutorials/AddRemark.md | 2 +- src/main/java/seedu/address/MainApp.java | 2 +- .../seedu/address/commons/core/Messages.java | 4 +- .../logic/commands/AddExpenseCommand.java | 8 +- .../commands/AddRecurringExpenseCommand.java | 9 +- .../address/logic/commands/EditCategory.java | 9 + .../logic/commands/EditExpenseCommand.java | 4 - .../address/logic/commands/ListCommand.java | 2 +- .../logic/commands/SetBudgetCommand.java | 6 +- .../seedu/address/model/AnalyticModel.java | 5 + .../address/model/AnalyticModelManager.java | 8 + .../java/seedu/address/model/UserPrefs.java | 2 +- .../expense/RecurringExpenseManager.java | 6 +- .../model/expense/RecurringExpenseType.java | 2 +- .../model/util/SampleExpenseTracker.java | 15 +- .../java/seedu/address/ui/HelpWindow.java | 34 ++- .../seedu/address/ui/StatisticsPanel.java | 9 +- src/main/java/seedu/address/ui/UiManager.java | 3 +- src/main/resources/view/ExpenseListCard.fxml | 2 +- .../view/RecurringExpenseListCard.fxml | 2 +- .../ExtraValuesUserPref.json | 2 +- .../TypicalUserPref.json | 2 +- .../seedu/address/logic/LogicManagerTest.java | 4 +- .../storage/JsonUserPrefsStorageTest.java | 2 +- 26 files changed, 323 insertions(+), 58 deletions(-) delete mode 100644 data/addressbook.json create mode 100644 data/fastTrack.json diff --git a/data/addressbook.json b/data/addressbook.json deleted file mode 100644 index 76475dbde72..00000000000 --- a/data/addressbook.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "categories" : [ ], - "expenses" : [ ], - "budget" : { - "amount" : "500.0" - }, - "recurringGenerators" : [ ] -} diff --git a/data/fastTrack.json b/data/fastTrack.json new file mode 100644 index 00000000000..1c67bb12052 --- /dev/null +++ b/data/fastTrack.json @@ -0,0 +1,229 @@ +{ + "categories" : [ { + "categoryName" : "Food", + "summary" : "For food" + }, { + "categoryName" : "Entertainment", + "summary" : "For entertainment" + }, { + "categoryName" : "Transportation", + "summary" : "For bus, car, train" + }, { + "categoryName" : "Shopping", + "summary" : "" + }, { + "categoryName" : "Housing", + "summary" : "" + }, { + "categoryName" : "groceries", + "summary" : "" + } ], + "expenses" : [ { + "name" : "kopi", + "amount" : "4.0", + "date" : "2023-04-03", + "category" : { + "categoryName" : "Food", + "summary" : "For food" + } + }, { + "name" : "Meal at JE", + "amount" : "4.5", + "date" : "2023-04-02", + "category" : { + "categoryName" : "Food", + "summary" : "For food" + } + }, { + "name" : "kopi", + "amount" : "4.0", + "date" : "2023-04-02", + "category" : { + "categoryName" : "Food", + "summary" : "For food" + } + }, { + "name" : "kopi", + "amount" : "4.0", + "date" : "2023-04-01", + "category" : { + "categoryName" : "Food", + "summary" : "For food" + } + }, { + "name" : "kopi", + "amount" : "4.0", + "date" : "2023-03-31", + "category" : { + "categoryName" : "Food", + "summary" : "For food" + } + }, { + "name" : "kopi", + "amount" : "4.0", + "date" : "2023-03-30", + "category" : { + "categoryName" : "Food", + "summary" : "For food" + } + }, { + "name" : "kopi", + "amount" : "4.0", + "date" : "2023-03-29", + "category" : { + "categoryName" : "Food", + "summary" : "For food" + } + }, { + "name" : "kopi", + "amount" : "4.0", + "date" : "2023-03-28", + "category" : { + "categoryName" : "Food", + "summary" : "For food" + } + }, { + "name" : "kopi", + "amount" : "4.0", + "date" : "2023-03-27", + "category" : { + "categoryName" : "Food", + "summary" : "For food" + } + }, { + "name" : "kopi", + "amount" : "4.0", + "date" : "2023-03-26", + "category" : { + "categoryName" : "Food", + "summary" : "For food" + } + }, { + "name" : "Groceries", + "amount" : "56.3", + "date" : "2023-03-25", + "category" : { + "categoryName" : "Food", + "summary" : "For food" + } + }, { + "name" : "kopi", + "amount" : "4.0", + "date" : "2023-03-25", + "category" : { + "categoryName" : "Food", + "summary" : "For food" + } + }, { + "name" : "Shoes", + "amount" : "75.0", + "date" : "2023-03-20", + "category" : { + "categoryName" : "Shopping", + "summary" : "" + } + }, { + "name" : "Movie ticket", + "amount" : "12.99", + "date" : "2023-03-15", + "category" : { + "categoryName" : "Entertainment", + "summary" : "For entertainment" + } + }, { + "name" : "MRT fare", + "amount" : "45.8", + "date" : "2023-03-10", + "category" : { + "categoryName" : "Transportation", + "summary" : "For bus, car, train" + } + }, { + "name" : "milk", + "amount" : "4.5", + "date" : "2000-05-15", + "category" : { + "categoryName" : "groceries", + "summary" : "" + } + }, { + "name" : "milk", + "amount" : "4.5", + "date" : "2000-05-08", + "category" : { + "categoryName" : "groceries", + "summary" : "" + } + }, { + "name" : "milk", + "amount" : "4.5", + "date" : "2000-05-01", + "category" : { + "categoryName" : "groceries", + "summary" : "" + } + }, { + "name" : "milk", + "amount" : "4.5", + "date" : "2000-04-24", + "category" : { + "categoryName" : "groceries", + "summary" : "" + } + }, { + "name" : "milk", + "amount" : "4.5", + "date" : "2000-04-17", + "category" : { + "categoryName" : "groceries", + "summary" : "" + } + }, { + "name" : "milk", + "amount" : "4.5", + "date" : "2000-04-10", + "category" : { + "categoryName" : "groceries", + "summary" : "" + } + }, { + "name" : "milk", + "amount" : "4.5", + "date" : "2000-04-03", + "category" : { + "categoryName" : "groceries", + "summary" : "" + } + }, { + "name" : "milk", + "amount" : "4.5", + "date" : "2000-03-27", + "category" : { + "categoryName" : "groceries", + "summary" : "" + } + }, { + "name" : "milk", + "amount" : "4.5", + "date" : "2000-03-20", + "category" : { + "categoryName" : "groceries", + "summary" : "" + } + } ], + "budget" : { + "amount" : "800.0" + }, + "recurringGenerators" : [ { + "expenseName" : "kopi", + "expenseAmount" : "4.0", + "expenseCategory" : { + "categoryName" : "Food", + "summary" : "For food" + }, + "nextExpenseDate" : "2023-04-04", + "startDate" : "2023-03-25", + "endDate" : "2023-04-10", + "recurringExpenseType" : "DAILY" + } ] +} \ No newline at end of file diff --git a/docs/tutorials/AddRemark.md b/docs/tutorials/AddRemark.md index 9e05a9a7b75..2f4d9eaf411 100644 --- a/docs/tutorials/AddRemark.md +++ b/docs/tutorials/AddRemark.md @@ -295,7 +295,7 @@ While the changes to code may be minimal, the test data will have to be updated
-:exclamation: You must delete AddressBook’s storage file located at `/data/addressbook.json` before running it! Not doing so will cause AddressBook to default to an empty address book! +:exclamation: You must delete AddressBook’s storage file located at `/data/fastTrack.json` before running it! Not doing so will cause AddressBook to default to an empty address book!
diff --git a/src/main/java/seedu/address/MainApp.java b/src/main/java/seedu/address/MainApp.java index cfb7c6d1b5b..214910b1266 100644 --- a/src/main/java/seedu/address/MainApp.java +++ b/src/main/java/seedu/address/MainApp.java @@ -37,7 +37,7 @@ */ public class MainApp extends Application { - public static final Version VERSION = new Version(1, 2, 1, true); + public static final Version VERSION = new Version(1, 3, 1, true); private static final Logger logger = LogsCenter.getLogger(MainApp.class); diff --git a/src/main/java/seedu/address/commons/core/Messages.java b/src/main/java/seedu/address/commons/core/Messages.java index 15f5063e31b..7a62ffd6a1d 100644 --- a/src/main/java/seedu/address/commons/core/Messages.java +++ b/src/main/java/seedu/address/commons/core/Messages.java @@ -6,10 +6,10 @@ public class Messages { public static final String MESSAGE_UNKNOWN_COMMAND = "Unknown command"; - public static final String MESSAGE_EXPENSES_LISTED_OVERVIEW = "%1$d expenses listed!"; + public static final String MESSAGE_EXPENSES_LISTED_OVERVIEW = "%1$d expenses listed"; public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s"; - public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The person index provided is invalid"; + public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The index provided is invalid"; public static final String MESSAGE_INVALID_CATEGORY_DISPLAYED_INDEX = "The category index provided is invalid!"; public static final String MESSAGE_INVALID_EXPENSE_DISPLAYED_INDEX = "The expense index provided is invalid!"; public static final String MESSAGE_INVALID_RECURRING_EXPENSE_DISPLAYED_INDEX = "The recurring expense index " diff --git a/src/main/java/seedu/address/logic/commands/AddExpenseCommand.java b/src/main/java/seedu/address/logic/commands/AddExpenseCommand.java index 56af7970a15..f7f70647cf7 100644 --- a/src/main/java/seedu/address/logic/commands/AddExpenseCommand.java +++ b/src/main/java/seedu/address/logic/commands/AddExpenseCommand.java @@ -24,11 +24,11 @@ public class AddExpenseCommand extends Command { + PREFIX_NAME + "EXPENSE NAME " + PREFIX_CATEGORY + "CATEGORY " + PREFIX_PRICE + "AMOUNT " - + "[" + PREFIX_DATE + "DATE]" + + "[" + PREFIX_DATE + "DATE]\n" + "Example: " + COMMAND_WORD + " " - + PREFIX_NAME + "Milk" - + PREFIX_CATEGORY + "groceries" - + PREFIX_PRICE + "4.50" + + PREFIX_NAME + "Milk " + + PREFIX_CATEGORY + "groceries " + + PREFIX_PRICE + "4.50 " + PREFIX_DATE + "2/10/23"; public static final String MESSAGE_SUCCESS = "New expense added: %1$s"; diff --git a/src/main/java/seedu/address/logic/commands/AddRecurringExpenseCommand.java b/src/main/java/seedu/address/logic/commands/AddRecurringExpenseCommand.java index 74b9d3d70ef..f823549e718 100644 --- a/src/main/java/seedu/address/logic/commands/AddRecurringExpenseCommand.java +++ b/src/main/java/seedu/address/logic/commands/AddRecurringExpenseCommand.java @@ -2,7 +2,6 @@ import static java.util.Objects.requireNonNull; import static seedu.address.logic.parser.CliSyntax.PREFIX_CATEGORY; -import static seedu.address.logic.parser.CliSyntax.PREFIX_DATE; import static seedu.address.logic.parser.CliSyntax.PREFIX_END_DATE; import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; import static seedu.address.logic.parser.CliSyntax.PREFIX_PRICE; @@ -30,12 +29,12 @@ public class AddRecurringExpenseCommand extends Command { + PREFIX_START_DATE + "START_DATE " + "[" + PREFIX_END_DATE + "END_DATE]\n" + "Example: " + COMMAND_WORD + " " - + PREFIX_NAME + "Netflix" + + PREFIX_NAME + "Netflix " + PREFIX_CATEGORY + "Subscription " + PREFIX_PRICE + "10 " - + PREFIX_TIMESPAN + "week" - + PREFIX_DATE + "01/03/23 " - + PREFIX_DATE + "01/03/24\n"; + + PREFIX_TIMESPAN + "week " + + PREFIX_START_DATE + "01/03/23 " + + PREFIX_END_DATE + "01/03/24\n"; public static final String MESSAGE_SUCCESS = "New recurring expense added: %1$s"; public static final String MESSAGE_DUPLICATE_RECURRING_EXPENSE = "This recurring expense already exists in FastTrack"; diff --git a/src/main/java/seedu/address/logic/commands/EditCategory.java b/src/main/java/seedu/address/logic/commands/EditCategory.java index 0e883709e64..323923df4b4 100644 --- a/src/main/java/seedu/address/logic/commands/EditCategory.java +++ b/src/main/java/seedu/address/logic/commands/EditCategory.java @@ -1,6 +1,8 @@ package seedu.address.logic.commands; import static java.util.Objects.requireNonNull; +import static seedu.address.logic.parser.CliSyntax.PREFIX_CATEGORY; +import static seedu.address.logic.parser.CliSyntax.PREFIX_SUMMARY; import java.util.List; @@ -19,6 +21,13 @@ public class EditCategory extends Command { public static final String COMMAND_WORD = "edcat"; + public static final String MESSAGE_USAGE = COMMAND_WORD + + ": Edits the category identified by the index number used in the displayed category list.\n" + + "Parameters: INDEX (must be a positive integer)\n" + + "[" + PREFIX_CATEGORY + "CATEGORY] " + + "[" + PREFIX_SUMMARY + "SUMMARY] " + + "Example: " + COMMAND_WORD + " edcat 1 c/food s/for meals"; + private final Index targetIndex; private final String newCategoryName; diff --git a/src/main/java/seedu/address/logic/commands/EditExpenseCommand.java b/src/main/java/seedu/address/logic/commands/EditExpenseCommand.java index 11d2f24b870..1bd1af351da 100644 --- a/src/main/java/seedu/address/logic/commands/EditExpenseCommand.java +++ b/src/main/java/seedu/address/logic/commands/EditExpenseCommand.java @@ -75,10 +75,6 @@ public CommandResult execute(Model model) throws CommandException { throw new CommandException(Messages.MESSAGE_INVALID_EDIT_FOR_EXPENSE); } - //Check if index is valid - if (targetIndex == null) { - throw new CommandException(MESSAGE_USAGE); - } if (targetIndex.getZeroBased() >= lastShownListOfExpenses.size()) { throw new CommandException(Messages.MESSAGE_INVALID_EXPENSE_DISPLAYED_INDEX); } diff --git a/src/main/java/seedu/address/logic/commands/ListCommand.java b/src/main/java/seedu/address/logic/commands/ListCommand.java index 26d262c26dd..e8c775d0e66 100644 --- a/src/main/java/seedu/address/logic/commands/ListCommand.java +++ b/src/main/java/seedu/address/logic/commands/ListCommand.java @@ -26,7 +26,7 @@ public class ListCommand extends Command { public static final String MESSAGE_USAGE = COMMAND_WORD + ": Lists expenses based on a filter" + "Parameters: " + PREFIX_CATEGORY + "CATEGORY " - + PREFIX_TIMESPAN + "TIMESPAN (Week, Month, Year) " + + PREFIX_TIMESPAN + "TIMESPAN (Week, Month, Year)\n" + "Example: " + COMMAND_WORD + " " + PREFIX_CATEGORY + "Food " + PREFIX_TIMESPAN + "week "; diff --git a/src/main/java/seedu/address/logic/commands/SetBudgetCommand.java b/src/main/java/seedu/address/logic/commands/SetBudgetCommand.java index bd83e4bb769..b6268cef5e0 100644 --- a/src/main/java/seedu/address/logic/commands/SetBudgetCommand.java +++ b/src/main/java/seedu/address/logic/commands/SetBudgetCommand.java @@ -14,10 +14,10 @@ public class SetBudgetCommand extends Command { public static final String COMMAND_WORD = "set"; - public static final String MESSAGE_USAGE = COMMAND_WORD + ": Sets monthly budget.\n" + public static final String MESSAGE_USAGE = COMMAND_WORD + ": Sets monthly budget\n" + "Parameters: " - + PREFIX_PRICE + "BUDGET_AMOUNT " - + "Example: " + COMMAND_WORD + " " + PREFIX_PRICE + " 1000"; + + PREFIX_PRICE + "BUDGET_AMOUNT\n" + + "Example: " + COMMAND_WORD + " " + PREFIX_PRICE + "1000"; public static final String MESSAGE_SUCCESS = "Monthly budget successfully set to "; private final Budget budget; diff --git a/src/main/java/seedu/address/model/AnalyticModel.java b/src/main/java/seedu/address/model/AnalyticModel.java index 8649d1404a1..da0c5c4c428 100644 --- a/src/main/java/seedu/address/model/AnalyticModel.java +++ b/src/main/java/seedu/address/model/AnalyticModel.java @@ -90,6 +90,11 @@ public interface AnalyticModel { */ double getBudget(); + /** + * Gets the Property of the users current monthly budget + */ + DoubleProperty getMonthlyBudgetProperty(); + /** * A convenience method to re-calculate and update all statistics */ diff --git a/src/main/java/seedu/address/model/AnalyticModelManager.java b/src/main/java/seedu/address/model/AnalyticModelManager.java index 1eb6d74197d..30edcc81b46 100644 --- a/src/main/java/seedu/address/model/AnalyticModelManager.java +++ b/src/main/java/seedu/address/model/AnalyticModelManager.java @@ -277,6 +277,14 @@ public double getBudget() { return monthlyBudget.get(); } + /** + * Gets the Property of the users current monthly budget + */ + @Override + public DoubleProperty getMonthlyBudgetProperty() { + return monthlyBudget; + } + /** * Returns a DoubleProperty representing analytics data for a given AnalyticsType. * @param type an AnalyticsType enum that specifies which type of analytics data to return diff --git a/src/main/java/seedu/address/model/UserPrefs.java b/src/main/java/seedu/address/model/UserPrefs.java index a03a67f32cd..97dc9f5687e 100644 --- a/src/main/java/seedu/address/model/UserPrefs.java +++ b/src/main/java/seedu/address/model/UserPrefs.java @@ -14,7 +14,7 @@ public class UserPrefs implements ReadOnlyUserPrefs { private GuiSettings guiSettings = new GuiSettings(); - private Path expenseTrackerFilePath = Paths.get("data" , "addressbook.json"); + private Path expenseTrackerFilePath = Paths.get("data" , "fastTrack.json"); /** * Creates a {@code UserPrefs} with default values. diff --git a/src/main/java/seedu/address/model/expense/RecurringExpenseManager.java b/src/main/java/seedu/address/model/expense/RecurringExpenseManager.java index 356aedba521..3f58756c854 100644 --- a/src/main/java/seedu/address/model/expense/RecurringExpenseManager.java +++ b/src/main/java/seedu/address/model/expense/RecurringExpenseManager.java @@ -61,7 +61,11 @@ public RecurringExpenseManager(String expenseName, double expenseAmount, public ArrayList getExpenses() { ArrayList expenses = new ArrayList<>(); - while (nextExpenseDate.isBefore(LocalDate.now())) { + LocalDate newEndDate = LocalDate.now(); + if (endDate != null) { + newEndDate = !endDate.isAfter(LocalDate.now()) ? endDate : LocalDate.now(); + } + while (!nextExpenseDate.isAfter(newEndDate)) { expenses.add(new Expense(expenseName, expenseAmount, nextExpenseDate, expenseCategory)); nextExpenseDate = recurringExpenseType.getNextExpenseDate(nextExpenseDate); } diff --git a/src/main/java/seedu/address/model/expense/RecurringExpenseType.java b/src/main/java/seedu/address/model/expense/RecurringExpenseType.java index cb66a250f40..72df74e4b96 100644 --- a/src/main/java/seedu/address/model/expense/RecurringExpenseType.java +++ b/src/main/java/seedu/address/model/expense/RecurringExpenseType.java @@ -24,7 +24,7 @@ public LocalDate getNextExpenseDate(LocalDate currentDate) { currentDate = currentDate.plusWeeks(1); break; case DAILY: - currentDate = LocalDate.now().plusDays(1); + currentDate = currentDate.plusDays(1); break; case YEARLY: currentDate = currentDate.plusYears(1); diff --git a/src/main/java/seedu/address/model/util/SampleExpenseTracker.java b/src/main/java/seedu/address/model/util/SampleExpenseTracker.java index 5e870e2d1df..f0151e51c86 100644 --- a/src/main/java/seedu/address/model/util/SampleExpenseTracker.java +++ b/src/main/java/seedu/address/model/util/SampleExpenseTracker.java @@ -13,14 +13,19 @@ * Class containing sample data for ExpenseTracker to initialize if needed. */ public class SampleExpenseTracker { + + private static final Category food = new UserDefinedCategory("Food", "For food"); + private static final Category entertainment = new UserDefinedCategory("Entertainment", "For entertainment"); + private static final Category transportation = new UserDefinedCategory("Transportation", "For bus, car, train"); + private static final Category shopping = new UserDefinedCategory("Shopping", ""); + private static final Category housing = new UserDefinedCategory("Housing", ""); /** * Sample data for categories * @return an array of sample categories. */ public static Category[] getSampleCategories() { return new Category[] { - new UserDefinedCategory("Food", "For food"), - new UserDefinedCategory("Entertainment", "For entertainment") + food, entertainment, transportation, shopping, housing }; } @@ -30,7 +35,11 @@ public static Category[] getSampleCategories() { */ public static Expense[] getSampleExpenses() { return new Expense[] { - new Expense("Meal at JE", 4.50, LocalDate.now(), new UserDefinedCategory("Food", "For food")) + new Expense("Meal at JE", 4.50, LocalDate.now(), food), + new Expense("Movie ticket", 12.99, LocalDate.of(2023, 3, 15), entertainment), + new Expense("MRT fare", 45.80, LocalDate.of(2023, 3, 10), transportation), + new Expense("Shoes", 75.00, LocalDate.of(2023, 3, 20), shopping), + new Expense("Groceries", 56.30, LocalDate.of(2023, 3, 25), food) }; } diff --git a/src/main/java/seedu/address/ui/HelpWindow.java b/src/main/java/seedu/address/ui/HelpWindow.java index cbe7a7d6e4a..40564414af7 100644 --- a/src/main/java/seedu/address/ui/HelpWindow.java +++ b/src/main/java/seedu/address/ui/HelpWindow.java @@ -16,28 +16,42 @@ public class HelpWindow extends UiPart { public static final String USERGUIDE_URL = - "https://docs.google.com/document/d/1nTsxXRuQh8OzcsR_LoAR6xX_pkw0IuO5HKIqznkDMzE/edit?usp=sharing"; + "https://ay2223s2-cs2103t-w09-2.github.io/tp/UserGuide.html"; public static final String HELP_MESSAGE_COMMAND = "Features:\n" + "help\n" + " - Accesses this help guide\n\n" - + "addcat [c/categoryName]\n" + + "addcat c/categoryName\n" + " - Adds a new category to the expense tracker\n\n" - + "delcat [index]\n" + + "delcat index\n" + " - Deletes a category from the expense tracker\n\n" - + "ecat [index] [c/categoryName] [s/summary]\n" + + "edcat index c/categoryName [s/summary]\n" + " - Edits specified category in the expense tracker\n\n" + "lcat\n" + " - Shows all categories in the expense tracker\n\n" - + "add [c/categoryName] [n/itemName] [p/price] [d/date]\n" + + "add n/expenseName c/categoryName p/price [d/Date]\n" + " - Adds an expense to the user's expense tracker\n\n" - + "delete [index]\n" + + "delete index\n" + " - Deletes expense at index [index]\n\n" - + "eexp [index] [c/categoryName] [n/expenseName] [d/Date] [p/price]\n" + + "edexp index [c/categoryName] [n/expenseName] [d/Date] [p/price]\n" + " - Edits specified expense in the expense tracker\n\n" - + "find [itemname]\n" - + " - lists all items with matching names\n\n" + + "addrec c/categoryName n/itemName p/price t/timeframe sd/startDate [ed/endDate]\n" + + " - Adds a recurring expense to the user's expense tracker\n\n" + + "delrec index\n" + + " - Deletes a recurring expense at index [index]\n\n" + + "edrec index [c/categoryName] [n/itemName] [p/price] [t/timeframe] [ed/endDate]\n" + + " - Edits specified expense in the expense tracker\n\n" + + "lrec\n" + + " - Displays the list of recurring expenses\n\n" + + "set p/budget\n" + + " - Sets the monthly budget in the expense tracker\n\n" + + "scat index\n" + + " - Displays summary text of category\n\n" + + "find [keyword]\n" + + " - lists all expenses with matching keywords\n\n" + "list [c/categoryName] [t/timeframe]\n" - + " - Toggles the view of summary of expenses\n\n"; + + " - Displays the list of expenses with optional category or time-span filters\n\n" + + "CLEAR\n" + + " - Clears all the expenses and categories stored in FastTrack\n\n"; public static final String HELP_MESSAGE = HELP_MESSAGE_COMMAND + "For more info, refer to the user guide: " + USERGUIDE_URL; diff --git a/src/main/java/seedu/address/ui/StatisticsPanel.java b/src/main/java/seedu/address/ui/StatisticsPanel.java index 74dac8567ca..0b4ce80ee9e 100644 --- a/src/main/java/seedu/address/ui/StatisticsPanel.java +++ b/src/main/java/seedu/address/ui/StatisticsPanel.java @@ -56,6 +56,9 @@ public StatisticsPanel(AnalyticModel analyticModel) { analyticModel.getMonthlySpent().addListener((observable, oldValue, newValue) -> { updateBudgetAdvice(newValue); }); + analyticModel.getMonthlyBudgetProperty().addListener((observable, oldValue, newValue) -> { + updateBudgetAdvice(analyticModel.getMonthlySpent().get()); + }); } /** @@ -146,10 +149,8 @@ private void bindAllValuesToStatistics() { * @param newValue the new value of the monthly spent */ private void updateBudgetAdvice(Number newValue) { - String adviceText; - if (newValue.doubleValue() <= analyticModel.getBudget()) { - adviceText = "Great job! You are within your budget!"; - } else { + String adviceText = "Great job! You are within your budget!"; + if (analyticModel.getBudget() != 0 && newValue.doubleValue() > analyticModel.getBudget()) { adviceText = "You have exceeded your monthly budget!"; } budgetAdvice.setText(adviceText); diff --git a/src/main/java/seedu/address/ui/UiManager.java b/src/main/java/seedu/address/ui/UiManager.java index 4445bd5c8d4..a6ed80581fd 100644 --- a/src/main/java/seedu/address/ui/UiManager.java +++ b/src/main/java/seedu/address/ui/UiManager.java @@ -35,9 +35,8 @@ public UiManager(Logic logic) { @Override public void start(Stage primaryStage) { logger.info("Starting UI..."); - //Set the application icon. -// primaryStage.getIcons().add(getImage(ICON_APPLICATION)); + //primaryStage.getIcons().add(getImage(ICON_APPLICATION)); try { mainWindow = new MainWindow(primaryStage, logic); diff --git a/src/main/resources/view/ExpenseListCard.fxml b/src/main/resources/view/ExpenseListCard.fxml index 3a96380f6e5..34f8df8f54e 100644 --- a/src/main/resources/view/ExpenseListCard.fxml +++ b/src/main/resources/view/ExpenseListCard.fxml @@ -30,7 +30,7 @@