From 454ba643e9c608d6abae80baf232b7a258102863 Mon Sep 17 00:00:00 2001 From: Tan Yi Xian <> Date: Sun, 6 Nov 2022 17:50:08 +0800 Subject: [PATCH 1/9] Add full stop to message --- .../foodrem/logic/commands/generalcommands/HelpCommand.java | 2 +- .../parser/generalcommandparser/HelpCommandParserTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/seedu/foodrem/logic/commands/generalcommands/HelpCommand.java b/src/main/java/seedu/foodrem/logic/commands/generalcommands/HelpCommand.java index 6cf7d46cc95..c7b151f1213 100644 --- a/src/main/java/seedu/foodrem/logic/commands/generalcommands/HelpCommand.java +++ b/src/main/java/seedu/foodrem/logic/commands/generalcommands/HelpCommand.java @@ -24,7 +24,7 @@ public class HelpCommand extends Command { + "in the command box, where COMMAND_WORD is any one of the following:\n" + CommandType.listAllCommandWords() + ".\n\n" + MORE_INFORMATION; - public static final String NOT_A_COMMAND = "\"%s\" is not a valid command\n\n" + HELP_FORMAT_GENERAL; + public static final String NOT_A_COMMAND = "\"%s\" is not a valid command.\n\n" + HELP_FORMAT_GENERAL; private static final String SHOWING_HELP_MESSAGE = "Opened help window."; private static final String HELP_FORMAT_SPECIFIC = "%s\n\n" + HELP_FORMAT_GENERAL; diff --git a/src/test/java/seedu/foodrem/logic/parser/generalcommandparser/HelpCommandParserTest.java b/src/test/java/seedu/foodrem/logic/parser/generalcommandparser/HelpCommandParserTest.java index 48abeaaee74..586b009792c 100644 --- a/src/test/java/seedu/foodrem/logic/parser/generalcommandparser/HelpCommandParserTest.java +++ b/src/test/java/seedu/foodrem/logic/parser/generalcommandparser/HelpCommandParserTest.java @@ -64,7 +64,7 @@ void parse_text() { assertEquals(EXPECTED_ALL_COMMANDS, CommandType.listAllCommandWords()); // Not a command constant - assertEquals("\"testing\" is not a valid command\n\n" + assertEquals("\"testing\" is not a valid command.\n\n" + "To receive help for a specific command, enter " + "\"help COMMAND_WORD\" in the command box, where COMMAND_WORD is any one of the following:\n" + EXPECTED_ALL_COMMANDS From 4b0423d4d1c8648414d529033c0351c9cc7ada79 Mon Sep 17 00:00:00 2001 From: Tan Yi Xian <> Date: Sun, 6 Nov 2022 17:50:24 +0800 Subject: [PATCH 2/9] Convert stats amount wasted to 2dp --- src/main/java/seedu/foodrem/views/StatsView.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/seedu/foodrem/views/StatsView.java b/src/main/java/seedu/foodrem/views/StatsView.java index bfaeb9f0279..474dcc5d32c 100644 --- a/src/main/java/seedu/foodrem/views/StatsView.java +++ b/src/main/java/seedu/foodrem/views/StatsView.java @@ -1,5 +1,6 @@ package seedu.foodrem.views; +import java.text.DecimalFormat; import java.util.List; import javafx.geometry.Pos; @@ -20,7 +21,7 @@ */ public class StatsView { private static final double SPACING_UNIT = 8; - + private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("0.00"); /** * Creates a new detailed view of the given item. * @@ -36,7 +37,8 @@ public static Node from(Stats stats) { // Section for amount wasted due to expired food final Label amountWastedLabel = new Label("Total cost incurred due to food wastage:"); - final Label amountWastedValue = new Label("$" + stats.getAmountWasted()); + String amountWasted = DECIMAL_FORMAT.format(stats.getAmountWasted()); + final Label amountWastedValue = new Label("$" + amountWasted); amountWastedValue.getStyleClass().add("bold"); amountWastedLabel.setWrapText(true); From 1efebed9af3cbdcd890f3cf0cd285b8b6688b255 Mon Sep 17 00:00:00 2001 From: Tan Yi Xian <> Date: Sun, 6 Nov 2022 17:50:45 +0800 Subject: [PATCH 3/9] Ensure consistency in ug and help command --- .../foodrem/commons/enums/CommandType.java | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/main/java/seedu/foodrem/commons/enums/CommandType.java b/src/main/java/seedu/foodrem/commons/enums/CommandType.java index 369c0eca39a..cb9b4ba965a 100644 --- a/src/main/java/seedu/foodrem/commons/enums/CommandType.java +++ b/src/main/java/seedu/foodrem/commons/enums/CommandType.java @@ -29,15 +29,17 @@ public String getUsage() { @Override public String getUsage() { return getCommandWord() + ": Displays help for FoodRem.\n\n" + + "Format:\n" + + getCommandWord() + " [COMMAND_WORD]\n\n" + "Example:\n" - + getCommandWord(); + + getCommandWord() + "\n" + + getCommandWord() + " new"; } }, RESET_COMMAND("reset") { @Override public String getUsage() { - return getCommandWord() + ": Clears all data in FoodRem. " - + "This includes all items and tags currently stored.\n\n" + return getCommandWord() + ": Clears all items and tags in FoodRem.\n\n" + "Example:\n" + getCommandWord(); } @@ -79,7 +81,7 @@ public String getUsage() { + "[" + PREFIX_ITEM_UNIT + "UNIT] " + "[" + PREFIX_ITEM_BOUGHT_DATE + "BOUGHT_DATE] " + "[" + PREFIX_ITEM_EXPIRY_DATE + "EXPIRY_DATE] " - + "[" + PREFIX_ITEM_PRICE + "PRICE]" + + "[" + PREFIX_ITEM_PRICE + "PRICE] " + "[" + PREFIX_ITEM_REMARKS + "REMARKS]\n\n" + "Examples:\n" + getCommandWord() + " 1 " @@ -106,7 +108,7 @@ public String getUsage() { FIND_COMMAND("find") { @Override public String getUsage() { - return getCommandWord() + ": Finds all items in FoodRem whose names contain substrings of any of " + return getCommandWord() + ": Finds all items in FoodRem whose names contain substrings of " + "the KEYWORDS (case-insensitive).\n\n" + "Format:\n" + getCommandWord() + " KEYWORD [KEYWORDS]...\n\n" @@ -138,7 +140,7 @@ public String getUsage() { NEW_COMMAND("new") { @Override public String getUsage() { - return getCommandWord() + ": Creates a new item with the provided item name. " + return getCommandWord() + ": Creates a new item with the provided information. " + "All fields apart from ITEM_NAME are optional.\n\n" + "Format:\n" + getCommandWord() + " " @@ -147,7 +149,7 @@ public String getUsage() { + "[" + PREFIX_ITEM_UNIT + "UNIT] " + "[" + PREFIX_ITEM_BOUGHT_DATE + "BOUGHT_DATE] " + "[" + PREFIX_ITEM_EXPIRY_DATE + "EXPIRY_DATE] " - + "[" + PREFIX_ITEM_PRICE + "PRICE]" + + "[" + PREFIX_ITEM_PRICE + "PRICE] " + "[" + PREFIX_ITEM_REMARKS + "REMARKS]\n\n" + "Examples:\n" + getCommandWord() + " " @@ -156,9 +158,9 @@ public String getUsage() { + PREFIX_NAME + "Potatoes " + PREFIX_ITEM_QUANTITY + "10 " + PREFIX_ITEM_UNIT + "kg " - + PREFIX_ITEM_BOUGHT_DATE + "11-11-2022 " - + PREFIX_ITEM_EXPIRY_DATE + "21-11-2022 " - + PREFIX_ITEM_PRICE + "10" + + PREFIX_ITEM_BOUGHT_DATE + "11-10-2022 " + + PREFIX_ITEM_EXPIRY_DATE + "21-10-2022 " + + PREFIX_ITEM_PRICE + "10 " + PREFIX_ITEM_REMARKS + "For Salad"; } }, @@ -166,15 +168,17 @@ public String getUsage() { @Override public String getUsage() { return getCommandWord() + ": Adds a remark to " + THE_ITEM_IN_LIST - + "Parameters: " - + PREFIX_ITEM_REMARKS - + "Example: " + getCommandWord() + " 1" + PREFIX_ITEM_REMARKS + "For oranges"; + + "\nFormat:\n" + + getCommandWord() + " INDEX [" + PREFIX_ITEM_REMARKS + "REMARKS]\n\n" + + "Examples:\n" + + getCommandWord() + "\n" + + getCommandWord() + " 1 " + PREFIX_ITEM_REMARKS + "For oranges"; } }, SORT_COMMAND("sort") { @Override public String getUsage() { - return getCommandWord() + ": Sorts all items in FoodRem according to the specified criteria.\n" + return getCommandWord() + ": Sorts the list of currently displayed items by the provided criteria.\n" + "Available criteria includes sorting by name, quantity, unit, bought date, expiry date, " + "price and remarks.\n\n" + "Format (Only one of the optional prefix should be present):\n" @@ -184,7 +188,7 @@ public String getUsage() { + "[" + PREFIX_ITEM_UNIT + "] " + "[" + PREFIX_ITEM_BOUGHT_DATE + "] " + "[" + PREFIX_ITEM_EXPIRY_DATE + "] " - + "[" + PREFIX_ITEM_PRICE + "]" + + "[" + PREFIX_ITEM_PRICE + "] " + "[" + PREFIX_ITEM_REMARKS + "]\n\n" + "Examples:\n" + getCommandWord() + " " + PREFIX_NAME + "\n" @@ -242,7 +246,7 @@ public String getUsage() { @Override public String getUsage() { return getCommandWord() + ": Renames an existing tag in FoodRem.\n\n" - + "Format (Original Tag: First TAG_NAME. Renamed Tag: Second TAG_NAME):\n" + + "Format (Original Tag: First TAG_NAME. Renamed Tag: Second TAG_NAME.):\n" + getCommandWord() + " " + PREFIX_NAME + "TAG_NAME " + PREFIX_NAME + "TAG_NAME\n\n" From 00df63f6f82e6fec85c7dd370d51d87c11a2efd2 Mon Sep 17 00:00:00 2001 From: Tan Yi Xian <> Date: Sun, 6 Nov 2022 18:14:51 +0800 Subject: [PATCH 4/9] Fix out of bound error in stats when no items --- src/main/java/seedu/foodrem/views/StatsView.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/seedu/foodrem/views/StatsView.java b/src/main/java/seedu/foodrem/views/StatsView.java index 474dcc5d32c..5c3d19cce66 100644 --- a/src/main/java/seedu/foodrem/views/StatsView.java +++ b/src/main/java/seedu/foodrem/views/StatsView.java @@ -2,6 +2,7 @@ import java.text.DecimalFormat; import java.util.List; +import java.util.stream.Collectors; import javafx.geometry.Pos; import javafx.scene.Node; @@ -67,12 +68,13 @@ public static Node from(Stats stats) { return statsView; } - private static Node[] buildTopThreeMostExpensiveItemsListFrom(Stats stats) { + private static List buildTopThreeMostExpensiveItemsListFrom(Stats stats) { List expensiveItems = stats.getTopThreeMostExpensiveItems(); - Node[] nodes = expensiveItems.stream().map(ItemView::from) - .peek(node -> node.setStyle("-fx-padding: 20 0 0 0")).toArray(Node[]::new); - nodes[0].setStyle("-fx-padding: 0"); + List nodes = expensiveItems.stream().map(ItemView::from) + .peek(node -> node.setStyle("-fx-padding: 20 0 0 0")).collect(Collectors.toList()); + if (!nodes.isEmpty()) { + nodes.get(0).setStyle("-fx-padding: 0"); + } return nodes; } - } From b753e7090b2add91bf720169291b72d9d91d2c02 Mon Sep 17 00:00:00 2001 From: Tan Yi Xian <> Date: Sun, 6 Nov 2022 21:50:31 +0800 Subject: [PATCH 5/9] Add reposense @@author tag --- src/main/java/seedu/foodrem/commons/core/Version.java | 2 +- src/main/java/seedu/foodrem/model/UserPrefs.java | 2 +- src/main/java/seedu/foodrem/model/util/SampleDataUtil.java | 3 +-- src/test/java/seedu/foodrem/testutil/ItemsToSort.java | 3 +-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/seedu/foodrem/commons/core/Version.java b/src/main/java/seedu/foodrem/commons/core/Version.java index 27e5a220b3d..4b89b0af247 100644 --- a/src/main/java/seedu/foodrem/commons/core/Version.java +++ b/src/main/java/seedu/foodrem/commons/core/Version.java @@ -1,3 +1,4 @@ +/* @@author */ package seedu.foodrem.commons.core; import java.util.regex.Matcher; @@ -8,7 +9,6 @@ /** * Represents a version with major, minor and patch number - * @author */ public class Version implements Comparable { private static final String VERSION_REGEX = "V(\\d+)\\.(\\d+)\\.(\\d+)(ea)?"; diff --git a/src/main/java/seedu/foodrem/model/UserPrefs.java b/src/main/java/seedu/foodrem/model/UserPrefs.java index b1160e524a5..46711e3b5e0 100644 --- a/src/main/java/seedu/foodrem/model/UserPrefs.java +++ b/src/main/java/seedu/foodrem/model/UserPrefs.java @@ -1,3 +1,4 @@ +/* @@author */ package seedu.foodrem.model; import static java.util.Objects.requireNonNull; @@ -10,7 +11,6 @@ /** * Represents User's preferences. - * @author */ public class UserPrefs implements ReadOnlyUserPrefs { private GuiSettings guiSettings = new GuiSettings(); diff --git a/src/main/java/seedu/foodrem/model/util/SampleDataUtil.java b/src/main/java/seedu/foodrem/model/util/SampleDataUtil.java index 7a0c6ac2b10..40cd0baad0f 100644 --- a/src/main/java/seedu/foodrem/model/util/SampleDataUtil.java +++ b/src/main/java/seedu/foodrem/model/util/SampleDataUtil.java @@ -1,3 +1,4 @@ +/* @@author */ package seedu.foodrem.model.util; import java.util.HashSet; @@ -17,8 +18,6 @@ /** * Contains utility methods for populating {@code FoodRem} with sample data. - * - * @author */ public class SampleDataUtil { public static Item[] getSampleItems() { diff --git a/src/test/java/seedu/foodrem/testutil/ItemsToSort.java b/src/test/java/seedu/foodrem/testutil/ItemsToSort.java index d98bcb13b5e..c25d91af118 100644 --- a/src/test/java/seedu/foodrem/testutil/ItemsToSort.java +++ b/src/test/java/seedu/foodrem/testutil/ItemsToSort.java @@ -1,3 +1,4 @@ +/* @@author */ package seedu.foodrem.testutil; import java.util.ArrayList; @@ -8,8 +9,6 @@ /** * A utility class containing a list of {@code item} objects to be used in tests related to sorting. - * - * @author */ public class ItemsToSort { public static final Item NI_Q1_U114_B119_E18_P13_R3 = new ItemBuilder().withItemName("NI Q1 U114 B119 E18 P13 R3") From 4128d2d9b506e80652371a70cd51f5c682678be5 Mon Sep 17 00:00:00 2001 From: Eugenetanwl3881 Date: Sun, 6 Nov 2022 22:02:03 +0800 Subject: [PATCH 6/9] Update PPP PR links --- docs/team/eugenetanwl3881.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/team/eugenetanwl3881.md b/docs/team/eugenetanwl3881.md index c79512f247d..199c6c9de52 100644 --- a/docs/team/eugenetanwl3881.md +++ b/docs/team/eugenetanwl3881.md @@ -14,30 +14,30 @@ Given below are my contributions to the project. * **New Feature**: Added the ability tag an item - * What it does: allows the user to tag a valid item with a valid tag (PR [\#171](https://github.com/AY2223S1-CS2103T-W16-2/tp/pull/171), [\#172](https://github.com/AY2223S1-CS2103T-W16-2/tp/pull/172)) + * What it does: allows the user to tag a valid item with a valid tag ([[PR#171]], [[PR#172]]) * Justification: This feature improves the product significantly since a user will be able to tag items with a specific tag for classification purposes. This tag will be unique and can be referenced by any item if the item contains this tag * Highlights: This enhancement will allow for better classification and searching for items in other commands. For instance -* **New Feature**: Added the ability untag an item (PR [\#172](https://github.com/AY2223S1-CS2103T-W16-2/tp/pull/172)) +* **New Feature**: Added the ability untag an item ([[PR#172]]) * What it does: Similar to tag feature, just that items can be untagged if user does not want to use that tag to classify an item anymore. -* **New Feature**: Added the ability list all tags (PR [\#200](https://github.com/AY2223S1-CS2103T-W16-2/tp/pull/200)) +* **New Feature**: Added the ability list all tags ([[PR#200]]) * What it does: User can call the `listtag` command to see all the tags that is available * Justification: User may not remember what were the tags he has created or deleted, hence will need a way to check * Highlights: This feature will be useful when trying to use other tag commands since user can see all the available tags * **Refactored feature**: - * Refactored the `clear` command in AB3 to the `reset` command in FoodRem. This clears all items and tags stored (PR [\#160](https://github.com/AY2223S1-CS2103T-W16-2/tp/pull/160)) + * Refactored the `clear` command in AB3 to the `reset` command in FoodRem. This clears all items and tags stored ([[PR#160]])) * **Code contributed**: [RepoSense link](https://nus-cs2103-ay2223s1.github.io/tp-dashboard/?search=&sort=groupTitle&sortWithin=title&timeframe=commit&mergegroup=&groupSelect=groupByRepos&breakdown=true&checkedFileTypes=docs~functional-code~test-code~other&since=2022-09-16&tabOpen=true&tabType=authorship&tabAuthor=Eugenetanwl3881&tabRepo=AY2223S1-CS2103T-W16-2%2Ftp%5Bmaster%5D&authorshipIsMergeGroup=false&authorshipFileTypes=functional-code&authorshipIsBinaryFileTypeChecked=false&authorshipIsIgnoredFilesChecked=false) * **Project management**: - * Refactoring done to project packages (PR [\#149](https://github.com/AY2223S1-CS2103T-W16-2/tp/pull/149)) - * Team tasks: Creation of issues, completing some weekly team tasks, updating AboutUs (PR [\#241](https://github.com/AY2223S1-CS2103T-W16-2/tp/pull/241), [[PR#22]]) + * Refactoring done to project packages ([[PR#149]]) + * Team tasks: Creation of issues, completing some weekly team tasks, updating AboutUs ( [[PR#241]], [[PR#22]]) * **Testing**: - * Wrote some tests for tag features (PRs [\#235](https://github.com/AY2223S1-CS2103T-W16-2/tp/pull/235)) + * Wrote some tests for tag features ([[PR#235]]) * **Documentation**: From ada1d49fb3d80df100e9f5d8ed5e94e042e13fe1 Mon Sep 17 00:00:00 2001 From: Eugenetanwl3881 Date: Sun, 6 Nov 2022 22:04:43 +0800 Subject: [PATCH 7/9] Update PPP PR info --- docs/team/eugenetanwl3881.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/team/eugenetanwl3881.md b/docs/team/eugenetanwl3881.md index 199c6c9de52..babe65ad10b 100644 --- a/docs/team/eugenetanwl3881.md +++ b/docs/team/eugenetanwl3881.md @@ -54,7 +54,7 @@ Given below are my contributions to the project. * DG User Stories Table ([[PR#419]]) * Added Instructions for Manual testing ([[PR#505]]) * Added Effort Section ([[PR#503]]) - * Updating and fixing bugs in DG ([[PR#36]],[[PR#278]], [[PR#281]], [[PR#287]], [[PR#319]], [[PR#334]], [[PR#419]]) + * Updating and fixing bugs in DG ([[PR#36]],[[PR#278]], [[PR#281]], [[PR#287]], [[PR#319]], [[PR#334]], [[PR#419]], [[PR#521]]) * **Community**: From 669fbde98fb00780be4fdad25068531009d9c000 Mon Sep 17 00:00:00 2001 From: Tan Yi Xian <> Date: Sun, 6 Nov 2022 22:11:03 +0800 Subject: [PATCH 8/9] Revert changes that cannot be done --- src/main/java/seedu/foodrem/commons/enums/CommandType.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/seedu/foodrem/commons/enums/CommandType.java b/src/main/java/seedu/foodrem/commons/enums/CommandType.java index cb9b4ba965a..5fb8e3726a3 100644 --- a/src/main/java/seedu/foodrem/commons/enums/CommandType.java +++ b/src/main/java/seedu/foodrem/commons/enums/CommandType.java @@ -39,7 +39,8 @@ public String getUsage() { RESET_COMMAND("reset") { @Override public String getUsage() { - return getCommandWord() + ": Clears all items and tags in FoodRem.\n\n" + return getCommandWord() + ": Clears all data in FoodRem. " + + "This includes all items and tags currently stored.\n\n" + "Example:\n" + getCommandWord(); } @@ -140,7 +141,7 @@ public String getUsage() { NEW_COMMAND("new") { @Override public String getUsage() { - return getCommandWord() + ": Creates a new item with the provided information. " + return getCommandWord() + ": Creates a new item with the provided item name. " + "All fields apart from ITEM_NAME are optional.\n\n" + "Format:\n" + getCommandWord() + " " @@ -178,7 +179,7 @@ public String getUsage() { SORT_COMMAND("sort") { @Override public String getUsage() { - return getCommandWord() + ": Sorts the list of currently displayed items by the provided criteria.\n" + return getCommandWord() + ": Sorts all items in FoodRem according to the specified criteria.\n" + "Available criteria includes sorting by name, quantity, unit, bought date, expiry date, " + "price and remarks.\n\n" + "Format (Only one of the optional prefix should be present):\n" From ad2486449dcc69b0d0eb42abb985c90a19b9f9d4 Mon Sep 17 00:00:00 2001 From: Tan Yi Xian <> Date: Sun, 6 Nov 2022 22:14:04 +0800 Subject: [PATCH 9/9] Fix test for help message --- .../logic/commands/generalcommands/HelpCommandTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/java/seedu/foodrem/logic/commands/generalcommands/HelpCommandTest.java b/src/test/java/seedu/foodrem/logic/commands/generalcommands/HelpCommandTest.java index 08f19b03329..46e47b0d778 100644 --- a/src/test/java/seedu/foodrem/logic/commands/generalcommands/HelpCommandTest.java +++ b/src/test/java/seedu/foodrem/logic/commands/generalcommands/HelpCommandTest.java @@ -22,8 +22,11 @@ class HelpCommandTest { @Test void getCommandHelpMessage() { String helpMessage = "help: Displays help for FoodRem.\n\n" + + "Format:\n" + + "help [COMMAND_WORD]\n\n" + "Example:\n" - + "help\n\n" + + "help\n" + + "help new\n\n" + "To receive help for a specific command, enter \"help COMMAND_WORD\" " + "in the command box, where COMMAND_WORD is any one of the following:\n" + "exit, help, reset, dec, del, edit, filtertag, find, inc, list, new, rmk, sort, view, "