From 7556e9813fa82bd728d7bc71056e669a7ee8d9b8 Mon Sep 17 00:00:00 2001 From: Nicholas Lee Date: Mon, 10 Apr 2023 23:38:37 +0800 Subject: [PATCH 1/2] fix duplicate category bug --- data/fastTrack.json | 61 ++++++++++++++++++- preferences.json | 2 +- .../commands/edit/EditCategoryCommand.java | 2 +- .../commands/edit/EditExpenseCommand.java | 2 +- .../EditRecurringExpenseManagerCommand.java | 2 +- 5 files changed, 62 insertions(+), 7 deletions(-) diff --git a/data/fastTrack.json b/data/fastTrack.json index ebb0064c941..1149c4bdc12 100644 --- a/data/fastTrack.json +++ b/data/fastTrack.json @@ -1,8 +1,63 @@ { - "categories" : [ ], - "expenses" : [ ], + "categories" : [ { + "categoryName" : "Food", + "summary" : "For food" + }, { + "categoryName" : "Entertainment", + "summary" : "For entertainment" + }, { + "categoryName" : "Transportation", + "summary" : "For bus, car, train" + }, { + "categoryName" : "Shopping", + "summary" : "" + }, { + "categoryName" : "Housing", + "summary" : "" + } ], + "expenses" : [ { + "name" : "Meal at JE", + "amount" : "4.5", + "date" : "2023-04-10", + "category" : { + "categoryName" : "Food", + "summary" : "For food" + } + }, { + "name" : "Groceries", + "amount" : "56.3", + "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" + } + } ], "budget" : { - "amount" : "4000.0" + "amount" : "0.0" }, "recurringGenerators" : [ ] } diff --git a/preferences.json b/preferences.json index 60dfa798666..1d8ca70fd1d 100644 --- a/preferences.json +++ b/preferences.json @@ -1,7 +1,7 @@ { "guiSettings" : { "windowWidth" : 1000.0, - "windowHeight" : 835.2000122070312, + "windowHeight" : 700.0, "windowCoordinates" : { "x" : 208, "y" : 25 diff --git a/src/main/java/fasttrack/logic/commands/edit/EditCategoryCommand.java b/src/main/java/fasttrack/logic/commands/edit/EditCategoryCommand.java index bce4a29f61d..346071db623 100644 --- a/src/main/java/fasttrack/logic/commands/edit/EditCategoryCommand.java +++ b/src/main/java/fasttrack/logic/commands/edit/EditCategoryCommand.java @@ -67,7 +67,7 @@ public CommandResult execute(Model model) throws CommandException { throw new CommandException(Messages.MESSAGE_INVALID_CATEGORY_NAME); } for (Category category : lastShownList) { - if (category.getCategoryName().equals(newCategoryName)) { + if (category.getCategoryName().equalsIgnoreCase(newCategoryName)) { throw new CommandException(MESSAGE_DUPLICATE_CATEGORY); } } diff --git a/src/main/java/fasttrack/logic/commands/edit/EditExpenseCommand.java b/src/main/java/fasttrack/logic/commands/edit/EditExpenseCommand.java index c74e9b4dc37..881a8ad6261 100644 --- a/src/main/java/fasttrack/logic/commands/edit/EditExpenseCommand.java +++ b/src/main/java/fasttrack/logic/commands/edit/EditExpenseCommand.java @@ -67,7 +67,7 @@ public CommandResult execute(Model model) throws CommandException { Category toBeAllocated = null; for (Category category : lastShownListOfCategories) { - if (category.getCategoryName().equals(this.newExpenseCategoryInString)) { + if (category.getCategoryName().equalsIgnoreCase(this.newExpenseCategoryInString)) { toBeAllocated = category; break; } diff --git a/src/main/java/fasttrack/logic/commands/edit/EditRecurringExpenseManagerCommand.java b/src/main/java/fasttrack/logic/commands/edit/EditRecurringExpenseManagerCommand.java index 1d5a5d5338a..f3d9231e641 100644 --- a/src/main/java/fasttrack/logic/commands/edit/EditRecurringExpenseManagerCommand.java +++ b/src/main/java/fasttrack/logic/commands/edit/EditRecurringExpenseManagerCommand.java @@ -83,7 +83,7 @@ public CommandResult execute(Model model) throws CommandException { Category toBeAllocated = null; for (Category category : lastShownListOfCategories) { - if (category.getCategoryName().equals(this.newExpenseCategoryInString)) { + if (category.getCategoryName().equalsIgnoreCase(this.newExpenseCategoryInString)) { toBeAllocated = category; break; } From 36df75fcc6e79591481837754230ca1d69bef604 Mon Sep 17 00:00:00 2001 From: Nicholas Lee Date: Mon, 10 Apr 2023 23:44:00 +0800 Subject: [PATCH 2/2] update version number --- src/main/java/fasttrack/MainApp.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/fasttrack/MainApp.java b/src/main/java/fasttrack/MainApp.java index 682b9998c36..cbaf8d9d8eb 100644 --- a/src/main/java/fasttrack/MainApp.java +++ b/src/main/java/fasttrack/MainApp.java @@ -36,7 +36,7 @@ */ public class MainApp extends Application { - public static final Version VERSION = new Version(1, 3, 1, true); + public static final Version VERSION = new Version(1, 4, 0, true); private static final Logger logger = LogsCenter.getLogger(MainApp.class);