From 4ad87053f0287cfc5dc7b9265c0749e4e8308dd9 Mon Sep 17 00:00:00 2001 From: EugeneChanJiajun Date: Mon, 8 Apr 2024 12:37:08 +0800 Subject: [PATCH] update userguide and bug fix --- docs/DeveloperGuide.md | 2 - docs/README.md | 5 +- docs/UserGuide.md | 282 ++++++++++++++++-- omni.txt | 0 .../errorhandlers/CheckParameters.java | 4 +- .../omnitravel/omnitravel/OmniTravel.java | 1 - .../java/seedu/omnitravel/parser/Parser.java | 16 +- .../TravelActivityList.java | 4 +- src/main/java/seedu/omnitravel/ui/Ui.java | 3 +- 9 files changed, 275 insertions(+), 42 deletions(-) delete mode 100644 omni.txt diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 63fa83719f..60c9b031c4 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -125,8 +125,6 @@ functions. ## Instructions for manual testing - - - To add a general travel activity into the list Example: `add visit Paris /date 2024-12-12 /duration 2 weeks` diff --git a/docs/README.md b/docs/README.md index cad79e3286..22d92adb1a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,6 +1,9 @@ # Omnitravel -{Give product intro here} + +Omnitravel is a CLI (Command-Line Interface) app that simplifies travel planning and organization. +Users can add accommodations, food, and landmarks to their itinerary, manage activities easily, and track expenses. +The app offers search, filtering, and currency exchange features, ensuring a smooth travel planning experience. Useful links: * [User Guide](UserGuide.md) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index a699a88ffa..2feb124846 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -18,8 +18,19 @@ list via a Command Line Interface**. 5. Use the java -jar omni.jar command to run the application. 6. A GUI similar to the below should appear in a few seconds. - - +``` +No existing database found! Creating a new save file for you! +____________________________________________________________ + ____ _ _ _ _____ ____ ____ _ _____ _ +/ _ \/ \__/|/ \ /|/ \/__ __\/ __\/ _ \/ \ |\/ __// \ +| / \|| |\/||| |\ ||| | / \ | \/|| / \|| | //| \ | | +| \_/|| | ||| | \||| | | | | /| |-||| \// | /_ | |_/\ +\____/\_/ \|\_/ \|\_/ \_/ \_/\_\\_/ \|\__/ \____\\____/) +Hello +How may I assist you? +____________________________________________________________ +``` +7. Type the `help` command in the command box and press enter to open the help window. ## Features > 📒 Notes about the command format : @@ -42,14 +53,34 @@ Example of usage: `help` +Expected outcome: + +{chenkang to include} + ### Adding a general travel activity : `add` Adds a general travel activity into the travel activity list Format: `add DESCRIPTION /date YYYY-MM-DD /duration DURATION [/tag TAG]` Examples of usage: -* `add Go to Japan /date 2024-03-14 /duration 7 hours` -* `add Go to Hong Kong /date 2024-08-25 /duration 6 hours /tag with family` +* `add Go to Japan /date 2025-03-14 /duration 7 hours` +* `add Go to Hong Kong /date 2025-08-25 /duration 6 hours /tag with family` + +Expected outcome: +Without tag +``` +____________________________________________________________ +I added a new travel activity +Go to Japan :14 Mar 2025 :7 hour +____________________________________________________________ +``` +With tag +``` +____________________________________________________________ +I added a new travel activity +Go to Hong Kong :25 Aug 2025 :6 hours (with family) +____________________________________________________________ +``` ### Add an accommodation activity type into the list : `accommodation` Adds an accommodation type travel activity into the travel activity list @@ -57,8 +88,24 @@ Adds an accommodation type travel activity into the travel activity list Format: `accommodation DESCRIPTION /date YYYY-MM-DD /duration DURATION [/tag TAG]` Examples of usage: -* `accommodation Four Seasons Hotel /date 2024-03-14 /duration 2 weeks` -* `accommodation Four Seasons Hotel /date 2024-08-25 /duration 2 weeks /tag first hotel` +* `accommodation Four Seasons Hotel /date 2025-03-14 /duration 2 weeks` +* `accommodation Four Seasons Hotel /date 2025-08-25 /duration 2 weeks /tag first hotel` + +Expected outcome: +Without tag +``` +____________________________________________________________ +I added a new accommodation +Accommodation: Four Seasons Hotel :14 Mar 2025 :2 weeks +____________________________________________________________ +``` +With tag +``` +____________________________________________________________ +I added a new accommodation +Accommodation: Four Seasons Hotel :25 Aug 2025 :2 weeks (first hotel) +____________________________________________________________ +``` ### Add a food activity type into the list : `food` Adds a food type travel activity into the travel activity list @@ -66,8 +113,25 @@ Adds a food type travel activity into the travel activity list Format: `food DESCRIPTION /date YYYY-MM-DD /duration DURATION [/tag TAG]` Examples of usage: -* `food Mala Hotpot /date 2024-03-14 /duration 2 hours` -* `food Mala Hotpot /date 2024-03-14 /duration 2 hours /tag very spicy` +* `food Mala Hotpot /date 2025-03-14 /duration 2 hours` +* `food Mala Hotpot /date 2025-03-14 /duration 2 hours /tag very spicy` + +Expected outcome: +Without tag +``` +____________________________________________________________ +I added a new food activity +Food: Mala Hotpot :14 Mar 2025 :2 hours +____________________________________________________________ +``` +With tag +``` +____________________________________________________________ +I added a new food activity +Food: Mala Hotpot :14 Mar 2025 :2 hours (very spicy) +____________________________________________________________ + +``` ### Add a landmark activity type into the list : `landmark` Adds a landmark type travel activity into the travel activity list @@ -75,8 +139,24 @@ Adds a landmark type travel activity into the travel activity list Format: `landmark DESCRIPTION /date YYYY-MM-DD /duration DURATION [/tag TAG]` Examples of usage: -* `landmark Eiffel Tower /date 2024-03-14 /duration 2 hours` -* `landmark Eiffel Tower /date 2024-03-14 /duration 2 hours /tag go up tower` +* `landmark Eiffel Tower /date 2025-03-14 /duration 2 hours` +* `landmark Eiffel Tower /date 2025-03-14 /duration 2 hours /tag go up tower` + +Expected outcome: +Without tag +``` +____________________________________________________________ +I added a new landmark +Landmark: Eiffel Tower :14 Mar 2025 :2 hours +____________________________________________________________ +``` +With tag +``` +____________________________________________________________ +I added a new landmark +Landmark: Eiffel Tower :14 Mar 2025 :2 hours (go up tower) +____________________________________________________________ +``` ### Find activity from the list using activity description : `find` Find an activity based on their description. All activities with the given description will be listed out. @@ -84,7 +164,16 @@ Find an activity based on their description. All activities with the given descr Format: `find DESCRIPTION` * `DESCRIPTION` has to match the activity description exactly to find the activity -Examples of usage: `find saizeriya` +Examples of usage (assuming saizeriya is in list): +* `find saizeriya` + +Expected output: +``` +____________________________________________________________ +Here are what you are looking for: +[ ] 1. Food: saizeriya :14 Mar 2025 :2 hours +____________________________________________________________ +``` ### Deleting a travel activity : `delete` Deletes a travel activity from the travel activity list @@ -92,14 +181,40 @@ Deletes a travel activity from the travel activity list Format: `delete INDEX` * `INDEX` has to be a number that is shown in the list of travel activities -Examples of usage: `delete 1` +Examples of usage: +* `delete 1` + +Expected output: +``` +____________________________________________________________ +I have removed this activity: +Accommodation: Four Seasons Hotel :14 Mar 2025 :2 days +____________________________________________________________ +``` ### Listing all the travel activities : `list` Shows all the travel activities including their tags and expenses Format: `list` -Examples of usage: `list` +Examples of usage: +* `list` + +Expected outcome: +``` +____________________________________________________________ +Here are the travel activities in your list: +[ ] 1. General: Go to Japan :14 Mar 2025 :7 hour +[ ] 2. General: Go to Hong Kong :25 Aug 2025 :6 hours (with family) +[ ] 3. Accommodation: Four Seasons Hotel :14 Mar 2025 :2 weeks +[ ] 4. Accommodation: Four Seasons Hotel :25 Aug 2025 :2 weeks (first hotel) +[ ] 5. Food: Mala Hotpot :14 Mar 2025 :2 hours +[ ] 6. Food: Mala Hotpot :14 Mar 2025 :2 hours (very spicy) +[ ] 7. Landmark: Eiffel Tower :14 Mar 2025 :2 hours +[ ] 8. Landmark: Eiffel Tower :14 Mar 2025 :2 hours (go up tower) +[ ] 9. Food: saizeriya :14 Mar 2025 :2 hours +____________________________________________________________ +``` ### Check a travel activity : `check` Checks a travel activity as completed. @@ -107,8 +222,16 @@ Checks a travel activity as completed. Format: `check INDEX` * `INDEX` has to be a number that is shown in the list of travel activities -Examples of usage: `check 1` +Examples of usage: +* `check 1` +Expected outcome: +``` +____________________________________________________________ +I have checked this activity: +[X] 1. General: Go to Japan :14 Mar 2025 :7 hour +____________________________________________________________ +``` ### Uncheck a travel activity : `uncheck` Unchecks travel activity and sets it to uncompleted. @@ -116,7 +239,16 @@ Unchecks travel activity and sets it to uncompleted. Format: `uncheck INDEX` * `INDEX` has to be a number that is shown in the list of travel activities -Examples of usage: `uncheck 1` +Examples of usage: +* `uncheck 1` + +Expected outcome: +``` +____________________________________________________________ +I have unchecked this activity: +[ ] 1. General: Go to Japan :14 Mar 2025 :7 hour +____________________________________________________________ +``` ### Updating a travel activity : `update` @@ -126,8 +258,17 @@ Format: `update INDEX /date YYYY-MM-DD /duration DURATION [/tag TAG]` * `INDEX` has to be a number that is shown in the list of travel activities Examples of usage: -* `update 1 /date 2019-12-14 /duration 2 hours` -* `update 2 /date 2018-12-12 /duration 3 hours /tag Important` +* `update 1 /date 2026-12-14 /duration 2 hours` +* `update 2 /date 2026-12-12 /duration 3 hours /tag Important` + +Expected outcome: +``` +____________________________________________________________ +I have updated this task +from: Go to Japan :14 Mar 2025 :7 hour +to: Go to Japan :14 Dec 2026 :2 hours +____________________________________________________________ +``` ### Adding a tag: `tag` Adds a new tag to an existing travel activity. @@ -137,8 +278,15 @@ Format: `tag INDEX TAGNAME` * The `INDEX` must be a valid activity index. Example of usage: +* `tag 1 activity 1` -`tag 1 activity 1` +Expected outcome: +``` +____________________________________________________________ +I have tagged this task: +Go to Japan :14 Dec 2026 :2 hours (activity 1) +____________________________________________________________ +``` ### Removing a tag: `untag` Removes a tag from an existing travel activity. @@ -148,8 +296,15 @@ Format: `untag INDEX` * The `INDEX` must be a valid activity index. Example of usage: +* `untag 1 ` -`untag 1 ` +Expected outcome: +``` +____________________________________________________________ +Tag removed from the task: +Go to Japan :14 Dec 2026 :2 hours +____________________________________________________________ +``` ### Find activity from the list using activity tag: `findtag` @@ -158,7 +313,16 @@ Find an activity based on their tag. All activities with the given tag will be l Format: `findtag TAG` * `TAG` has to match the activity tag exactly to find the activity -Examples of usage: `findtag sightseeing` +Examples of usage: +* `findtag spicy` + +Expected outcome: +``` +____________________________________________________________ +Here are what you are looking for: +[ ] 1. Food: Mala Hotpot :14 Mar 2025 :2 hours (very spicy) +____________________________________________________________ +``` ### List tags from the list : `listtags` @@ -166,15 +330,40 @@ Lists out all the tags that the user has placed in the list Format: `listtags` -Examples of usage: `listtags` +Examples of usage: +* `listtags` + +Expected outcome: +``` +____________________________________________________________ +These are the tags in your list: +1. activity 2 +2. first hotel +3. go up tower +4. very spicy +5. with family +____________________________________________________________ +``` + ### Find activity from the list using activity type : `findtype` Find an activity based on their type. All activities with the given type will be listed out. Format: `findtype TYPE` * `TYPE` has to match the activity type exactly to find the activity +* The different types are `general`, `accommodation`, `food`, `landmark` -Examples of usage: `findtype TravelActivity` +Examples of usage: +* `findtype general` + +Expected outcome: +``` +____________________________________________________________ +Here are what you are looking for: +[ ] 1. General: Go to Japan :14 Dec 2026 :2 hours (activity 2) +[ ] 2. General: Go to Hong Kong :25 Aug 2025 :6 hours (with family) +____________________________________________________________ +``` ### Adding an expense amount: `expense` Adds an expense amount to an existing travel activity. @@ -185,8 +374,15 @@ Format: `expense INDEX EXPENSE` * The `EXPENSE` can include the currency of the expense. Example of usage: +* `expense 2 $50` -`expense 2 $50` +Expected outcome: +``` +____________________________________________________________ +I have added expense for this task: +Go to Hong Kong :25 Aug 2025 :6 hours (with family) ($50) +____________________________________________________________ +``` ### Removing an expense amount: `removeexpense` Removes an expense amount to an existing travel activity. @@ -196,8 +392,15 @@ Format: `removeexpense INDEX` * The `INDEX` must be a valid activity index. Example of usage: +* `removeexpense 2` -`removeexpense 2` +Expected outcome: +``` +____________________________________________________________ +Expense removed from the task: +Go to Hong Kong :25 Aug 2025 :6 hours (with family) +____________________________________________________________ +``` ### Adding an expense amount: `totalexpense` Calculates the total expense for all activities of the given type in the travel activity list. @@ -207,10 +410,16 @@ Format: `totalexpense [/type TYPE]` * The `TYPE` must be a valid type (Accomodation, Food, Landmark, TravelActivity) Example of usage: - `totalexpense /type food` `totalexpense` +Expected outcome: +``` +____________________________________________________________ +The total expense for all travel activities is: $0.0 +____________________________________________________________ +``` + ### Converting a currency : `change` Converts the currency from one currency to another @@ -223,7 +432,27 @@ Format: `change AMOUNT /from CURRENCY1 /to CURRENCY2` Examples of usage: * change 100 /from sgd /to myr * change 1000 /from myr /to usd -* + +Expected outcome: +``` +____________________________________________________________ +100.0sgd = 352.1923myr +____________________________________________________________ +``` + +Common currency codes: +* USA: USD +* EURO: EUR +* ENGLAND: GBP +* JAPAN: JPY +* SINGAPORE: SGD +* HONG KONG: HKD +* AUSTRALIA: AUD +* NEW ZEALAND: NZD +* MALAYSIA: MYR +* CHINA: CNY +* KOREA: KRW + ## FAQ **Q**: How do I transfer my data to another computer? @@ -252,3 +481,4 @@ same location of your other computer to transfer all the activities. * Add expense `expense INDEX EXPENSE` * Remove expense `removeexpense INDEX` * Total expense `totalexpense [/type TYPE]` +* Check currency exchange `change AMOUNT /from CODE /to CODE` diff --git a/omni.txt b/omni.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/main/java/seedu/omnitravel/errorhandlers/CheckParameters.java b/src/main/java/seedu/omnitravel/errorhandlers/CheckParameters.java index 552102b88c..800632e63e 100644 --- a/src/main/java/seedu/omnitravel/errorhandlers/CheckParameters.java +++ b/src/main/java/seedu/omnitravel/errorhandlers/CheckParameters.java @@ -66,7 +66,7 @@ public static void updateExceptions(String[] command) throws OmniException { public static void containsWords(String input) throws OmniException{ String[] inputSplit = input.split(" "); if (inputSplit.length == 2){ - String[] durationKeyWords = {"day", "month", "year", "hour", "minute", "second"}; + String[] durationKeyWords = {"day", "week", "month", "year", "hour", "minute", "second"}; for(String word:durationKeyWords){ if(input.contains(word)){ return; @@ -74,7 +74,7 @@ public static void containsWords(String input) throws OmniException{ } } throw new OmniException("Your duration is invalid. Please input in terms of \"1 " + - "day, month, year, hour, minutue or second\""); + "day, week, month, year, hour, minutue or second\""); } /** diff --git a/src/main/java/seedu/omnitravel/omnitravel/OmniTravel.java b/src/main/java/seedu/omnitravel/omnitravel/OmniTravel.java index 53dd7e09b9..5b4c42d6b8 100644 --- a/src/main/java/seedu/omnitravel/omnitravel/OmniTravel.java +++ b/src/main/java/seedu/omnitravel/omnitravel/OmniTravel.java @@ -20,7 +20,6 @@ public class OmniTravel { //@@author EugeneChanJiajun public static void main(String[] args) throws IOException { - Logger logger = Logger.getLogger("Main"); initialiseLogger(logger); FileSave file = new FileSave("omni.txt"); diff --git a/src/main/java/seedu/omnitravel/parser/Parser.java b/src/main/java/seedu/omnitravel/parser/Parser.java index 93be481f24..ba452da604 100644 --- a/src/main/java/seedu/omnitravel/parser/Parser.java +++ b/src/main/java/seedu/omnitravel/parser/Parser.java @@ -11,6 +11,7 @@ import java.io.IOException; import java.time.LocalDate; +import java.util.Arrays; import java.util.logging.Logger; public class Parser { @@ -166,11 +167,12 @@ public static void uncheckCommand(String[] command, TravelActivityList list) thr public static void tagCommand(String line, TravelActivityList list) throws OmniException { String[] command = line.split(" "); if (command.length >= 3 && CheckParameters.isNumeric(command[1])){ - String index = command[1]; - String[] tagSplit = line.split(index); - String tag = tagSplit[1].trim(); - int listNumber = Integer.parseInt(index); - list.tagActivity(listNumber, tag); + int listNumber = Integer.parseInt(command[1]); + // Extract tags starting from the third element onwards + String[] tagArray = Arrays.copyOfRange(command, 2, command.length); + // Join the tags into a single string + String tags = String.join(" ", tagArray); + list.tagActivity(listNumber, tags); } else if (command.length == 2) { throw new OmniException("Please specify a tag name"); } else { @@ -354,8 +356,8 @@ public static void currencyExchangeCommand(String line) throws OmniException{ // Check parameters CheckParameters.checkCurrencyParameters(command, line); float amount = Float.parseFloat(command[1].trim()); - String localCurrency = command[2].trim(); - String foreignCurrency = command[3].trim(); + String localCurrency = command[2].toLowerCase().trim(); + String foreignCurrency = command[3].toLowerCase().trim(); CurrencyRate.convertCurrency(localCurrency, foreignCurrency, amount); } catch(InterruptedException | IOException exception){ System.out.println("Website might be down!"); diff --git a/src/main/java/seedu/omnitravel/travelactivitytypes/TravelActivityList.java b/src/main/java/seedu/omnitravel/travelactivitytypes/TravelActivityList.java index 407da6e81c..05185f9746 100644 --- a/src/main/java/seedu/omnitravel/travelactivitytypes/TravelActivityList.java +++ b/src/main/java/seedu/omnitravel/travelactivitytypes/TravelActivityList.java @@ -141,7 +141,7 @@ public void checkTravelActivity(int activityNumber) throws OmniException{ if (!markedActivity.getActivityStatus()) { markedActivity.setActivityStatus(true); System.out.println("I have checked this activity:"); - System.out.println(markedActivity); + Ui.printActivity(markedActivity, activityNumber); } else { System.out.println("This activity is already done!"); } @@ -162,7 +162,7 @@ public void uncheckTravelActivity(int activityNumber) throws OmniException{ if (markedActivity.getActivityStatus()) { markedActivity.setActivityStatus(false); System.out.println("I have unchecked this activity:"); - System.out.println(markedActivity); + Ui.printActivity(markedActivity, activityNumber); } else { System.out.println("This activity is already unchecked!"); } diff --git a/src/main/java/seedu/omnitravel/ui/Ui.java b/src/main/java/seedu/omnitravel/ui/Ui.java index af2d83d0cb..710b97c226 100644 --- a/src/main/java/seedu/omnitravel/ui/Ui.java +++ b/src/main/java/seedu/omnitravel/ui/Ui.java @@ -80,7 +80,8 @@ public static void helpCommand(){ "16. findtype \n" + "17. expense \n" + "18. removeexpense \n" + - "19. change /from /to "); + "19. totalexpense \n" + + "20. change /from /to "); printLine(); }