Skip to content

Commit

Permalink
Merge branch 'master' into bryan/update-tag-DG
Browse files Browse the repository at this point in the history
  • Loading branch information
RichDom2185 authored Nov 6, 2022
2 parents 4aedb9c + be20005 commit 660440b
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 36 deletions.
16 changes: 8 additions & 8 deletions docs/team/eugenetanwl3881.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**:

Expand All @@ -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**:

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/foodrem/commons/core/Version.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* @@author */
package seedu.foodrem.commons.core;

import java.util.regex.Matcher;
Expand All @@ -8,7 +9,6 @@

/**
* Represents a version with major, minor and patch number
* @author
*/
public class Version implements Comparable<Version> {
private static final String VERSION_REGEX = "V(\\d+)\\.(\\d+)\\.(\\d+)(ea)?";
Expand Down
29 changes: 17 additions & 12 deletions src/main/java/seedu/foodrem/commons/enums/CommandType.java
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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 "
Expand All @@ -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"
Expand Down Expand Up @@ -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() + " "
Expand All @@ -156,19 +159,21 @@ 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";
}
},
REMARK_COMMAND("rmk") {
@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") {
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/foodrem/model/UserPrefs.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* @@author */
package seedu.foodrem.model;

import static java.util.Objects.requireNonNull;
Expand All @@ -10,7 +11,6 @@

/**
* Represents User's preferences.
* @author
*/
public class UserPrefs implements ReadOnlyUserPrefs {
private GuiSettings guiSettings = new GuiSettings();
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/seedu/foodrem/model/util/SampleDataUtil.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* @@author */
package seedu.foodrem.model.util;

import java.util.HashSet;
Expand All @@ -17,8 +18,6 @@

/**
* Contains utility methods for populating {@code FoodRem} with sample data.
*
* @author
*/
public class SampleDataUtil {
public static Item[] getSampleItems() {
Expand Down
18 changes: 11 additions & 7 deletions src/main/java/seedu/foodrem/views/StatsView.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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.
*
Expand All @@ -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);

Expand Down Expand Up @@ -65,12 +68,13 @@ public static Node from(Stats stats) {
return statsView;
}

private static Node[] buildTopThreeMostExpensiveItemsListFrom(Stats stats) {
private static List<Node> buildTopThreeMostExpensiveItemsListFrom(Stats stats) {
List<Item> 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<Node> 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;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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, "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/seedu/foodrem/testutil/ItemsToSort.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* @@author */
package seedu.foodrem.testutil;

import java.util.ArrayList;
Expand All @@ -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")
Expand Down

0 comments on commit 660440b

Please sign in to comment.