diff --git a/docs/team/eugenetanwl3881.md b/docs/team/eugenetanwl3881.md index 0004aeade25..d12d4bec71a 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**: @@ -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**: 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/commons/enums/CommandType.java b/src/main/java/seedu/foodrem/commons/enums/CommandType.java index 369c0eca39a..5fb8e3726a3 100644 --- a/src/main/java/seedu/foodrem/commons/enums/CommandType.java +++ b/src/main/java/seedu/foodrem/commons/enums/CommandType.java @@ -29,8 +29,11 @@ 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") { @@ -79,7 +82,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 +109,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" @@ -147,7 +150,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 +159,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,9 +169,11 @@ 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") { @@ -184,7 +189,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 +247,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" 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 1f9f8f39ef0..61949a655ca 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/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/main/java/seedu/foodrem/views/StatsView.java b/src/main/java/seedu/foodrem/views/StatsView.java index bfaeb9f0279..5c3d19cce66 100644 --- a/src/main/java/seedu/foodrem/views/StatsView.java +++ b/src/main/java/seedu/foodrem/views/StatsView.java @@ -1,6 +1,8 @@ package seedu.foodrem.views; +import java.text.DecimalFormat; import java.util.List; +import java.util.stream.Collectors; import javafx.geometry.Pos; import javafx.scene.Node; @@ -20,7 +22,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 +38,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); @@ -65,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; } - } 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, " 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 9d32aa31520..98df7d33ea8 100644 --- a/src/test/java/seedu/foodrem/logic/parser/generalcommandparser/HelpCommandParserTest.java +++ b/src/test/java/seedu/foodrem/logic/parser/generalcommandparser/HelpCommandParserTest.java @@ -67,7 +67,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 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")