Skip to content

Commit

Permalink
Merge pull request #262 from nicleejy/master
Browse files Browse the repository at this point in the history
fix duplicate category bug
  • Loading branch information
gitsac authored Apr 10, 2023
2 parents 4c72854 + 36df75f commit 28510c8
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 8 deletions.
61 changes: 58 additions & 3 deletions data/fastTrack.json
Original file line number Diff line number Diff line change
@@ -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" : [ ]
}
2 changes: 1 addition & 1 deletion preferences.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"guiSettings" : {
"windowWidth" : 1000.0,
"windowHeight" : 835.2000122070312,
"windowHeight" : 700.0,
"windowCoordinates" : {
"x" : 208,
"y" : 25
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/fasttrack/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 28510c8

Please sign in to comment.