From 5321465d176194bd7a047f772520e18f6048174d Mon Sep 17 00:00:00 2001 From: Ferusel <53888954+Ferusel@users.noreply.github.com> Date: Fri, 28 Oct 2022 09:04:23 +0800 Subject: [PATCH 1/4] Fix UG description of statistics --- docs/_ug/commands/StatisticsCommands.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/docs/_ug/commands/StatisticsCommands.md b/docs/_ug/commands/StatisticsCommands.md index 154dc55e101..24744c12f84 100644 --- a/docs/_ug/commands/StatisticsCommands.md +++ b/docs/_ug/commands/StatisticsCommands.md @@ -9,9 +9,9 @@ ```note These statistics include: -* Items that expire within the next 10 days * Total cost of wasted items -* Most expensive item in your inventory +* Top 3 most commonly used tags in your inventory +* Top 3 most costly items in your inventory ``` **Example Input:** @@ -25,15 +25,16 @@ stats Command Output Box: ```text -Items that expire within the next 10 days: -1. Onions 8 kg $1 (Bought Date: 10-10-2022) (Expiry Date: 10-11-2022) -2. Chicken 30 kg $4.20 (Bought Date: 10-10-2022) (Expiry Date: 15-10-2022) -3. Carrots 11 kg $0.60 (Bought Date: 10-10-2022) (Expiry Date: 26-10-2022) - +Statistics Total cost of wasted items: $120 -Most expensive item in your inventory: -Chicken 30 kg $4.20 (Bought Date: 10-10-2022) (Expiry Date: 15-10-2022) +Top 3 common tags: +Drinks Fridge Fruits +Your top 3 items with highest value are as follows: + +1. Onions 8 kg $1 (Bought Date: 10-10-2022) (Expiry Date: 10-11-2022) +2. Chicken 30 kg $4.20 (Bought Date: 10-10-2022) (Expiry Date: 15-10-2022) +3. Carrots 11 kg $0.60 (Bought Date: 10-10-2022) (Expiry Date: 26-10-2022) ``` From 3c8f9d5359b9c5f4fcb31bce49e5585941621e3e Mon Sep 17 00:00:00 2001 From: Ferusel <53888954+Ferusel@users.noreply.github.com> Date: Fri, 28 Oct 2022 09:07:31 +0800 Subject: [PATCH 2/4] Fix string formatting of item price and cost --- src/main/java/seedu/foodrem/model/item/ItemPrice.java | 2 +- src/main/java/seedu/foodrem/views/ItemView.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/seedu/foodrem/model/item/ItemPrice.java b/src/main/java/seedu/foodrem/model/item/ItemPrice.java index f88d73b223f..e71f5b7a26a 100644 --- a/src/main/java/seedu/foodrem/model/item/ItemPrice.java +++ b/src/main/java/seedu/foodrem/model/item/ItemPrice.java @@ -11,7 +11,7 @@ * Guarantees: details are present and not null, field values are validated, immutable. */ public class ItemPrice { - private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.00"); + private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("0.00"); private static final double DEFAULT_PRICE = 0; private final double itemPrice; diff --git a/src/main/java/seedu/foodrem/views/ItemView.java b/src/main/java/seedu/foodrem/views/ItemView.java index 412bb8b459c..a9684c30d25 100644 --- a/src/main/java/seedu/foodrem/views/ItemView.java +++ b/src/main/java/seedu/foodrem/views/ItemView.java @@ -48,7 +48,7 @@ public static Node from(Item item) { final Label priceValue = new Label(item.getPrice().toString()); priceValue.getStyleClass().add("bold"); final Label costLabel = new Label("Total Cost: $"); - final Label costValue = new Label(String.valueOf(item.getItemCost())); + final Label costValue = new Label(String.format("%.2f", item.getItemCost())); costValue.getStyleClass().add("bold"); final Label remarks = new Label(item.getRemarks().toString().isBlank() ? "-" : item.getRemarks().toString()); From a46313bdf054c3cf76c5432f93281f42470ccb3d Mon Sep 17 00:00:00 2001 From: Ferusel <53888954+Ferusel@users.noreply.github.com> Date: Fri, 28 Oct 2022 09:08:39 +0800 Subject: [PATCH 3/4] Remove unused TODO --- docs/_ug/commands/StatisticsCommands.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/_ug/commands/StatisticsCommands.md b/docs/_ug/commands/StatisticsCommands.md index 24744c12f84..cf51001b936 100644 --- a/docs/_ug/commands/StatisticsCommands.md +++ b/docs/_ug/commands/StatisticsCommands.md @@ -1,8 +1,6 @@ #### Display statistics: `stats` - - **Format**: `stats` > Displays relevant statistics collected by FoodRem. From 70132514bded370b96705478acc2cc59d041615e Mon Sep 17 00:00:00 2001 From: Ferusel <53888954+Ferusel@users.noreply.github.com> Date: Fri, 28 Oct 2022 09:11:35 +0800 Subject: [PATCH 4/4] Add additional description for statistics command --- docs/_ug/commands/StatisticsCommands.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/_ug/commands/StatisticsCommands.md b/docs/_ug/commands/StatisticsCommands.md index cf51001b936..2fd0c760615 100644 --- a/docs/_ug/commands/StatisticsCommands.md +++ b/docs/_ug/commands/StatisticsCommands.md @@ -10,6 +10,8 @@ These statistics include: * Total cost of wasted items * Top 3 most commonly used tags in your inventory * Top 3 most costly items in your inventory + +The cost of an item is the price of the item multiplied by the number of those items in your inventory. ``` **Example Input:**