Skip to content

Commit

Permalink
Merge pull request #213 from EugeneChanJiajun/master
Browse files Browse the repository at this point in the history
Bug fix @ChinYanXu
  • Loading branch information
daryltay415 committed Apr 9, 2024
2 parents 87aefa9 + 12cba98 commit 584a8b4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 69 deletions.
16 changes: 2 additions & 14 deletions omni.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,2 @@
accommodation / 0 / nus rvrc / 2024-04-04 / 2 days / test / $50
accommodation / 0 / nus pgpr / 2025-10-12 / 5 years / campus stay /
accommodation / 0 / nus utr / 2025-09-12 / 5 years / campus stay /
landmark / 0 / berlin wall / 2027-12-15 / 5 hours / historic site /
landmark / 0 / utown / 2028-08-14 / 10 hours / recreational centre /
landmark / 0 / supper stretch / 2027-08-18 / 2 hours / tourist hotspot /
food / 0 / utown mala / 2028-06-19 / 2 hours / spicy /
food / 0 / pgpr mala / 2026-07-07 / 1 hours / spicy /
food / 0 / pgpr waffle / 2026-03-09 / 0.5 hours / non-spicy /
general / 0 / esplanade / 2026-03-19 / 3 hours / concert /
general / 0 / merlion / 2026-04-07 / 2 hours / sightseeing /
general / 0 / chinatown / 2025-02-21 / 5 hours / sightseeing /
accommodation / 0 / description / 2024-10-04 / 2 days / test /

landmark / 0 / berlin wall / 2027-12-15 / 5 hours / historic site / / null
landmark / 0 / supper stretch / 2027-08-18 / 2 hours / tourist hotspot / / null
8 changes: 4 additions & 4 deletions src/main/java/seedu/omnitravel/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class Parser {

private static Logger logger = Logger.getLogger("ParserLogger");


//@@author ChinYanXu
/**
* Obtains the list of travel activities
*
Expand All @@ -34,7 +34,7 @@ public static void getList(String[] command, TravelActivityList list) throws Omn
}
Ui.printLine();
}

//@@author ChinYanXu
/**
* Handles the case where the add command is given as input
*
Expand Down Expand Up @@ -106,7 +106,7 @@ public static void addCommand(String line, TravelActivityList list) throws OmniE
System.out.println(newActivity);
Ui.printLine();
}

//@@author ChinYanXu
/**
* Handles the case where the delete command is given as input
*
Expand All @@ -121,7 +121,7 @@ public static void deleteCommand(String[] command, TravelActivityList list) thro
throw new OmniException("Please specify which activity index or description to delete");
}
}

//@@author ChinYanXu
/**
* Handles the case where the check command is given as input
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public int getNoOfTravelActivities(){
return noOfActivities;
}

//@@author ChinYanXu
/**
* Removes travel activity from the travel activity list
* @param activityNumber The travel activity index number or description on the list
Expand All @@ -83,6 +84,7 @@ public void removeTravelActivity(String activityNumber) throws OmniException {
int newSize = noOfActivities;
assert newSize == initialListSize - 1 : "There is an error with list size!";
} catch (NumberFormatException e) {
/*
int foundCounter = 0;
for (int iterator = 0; iterator < travelActivities.size(); iterator += 1) {
if (travelActivities.get(iterator).getPlan().toLowerCase().contains(activityNumber.toLowerCase())) {
Expand All @@ -91,17 +93,24 @@ public void removeTravelActivity(String activityNumber) throws OmniException {
}
System.out.println(Integer.toString(foundCounter + 1) + ". " + travelActivities.get(iterator));
travelActivities.remove(iterator);
noOfActivities -= 1;
foundCounter += 1;
assert noOfActivities >= 0 : "There is an error with list size!";
}
}
noOfActivities -= foundCounter;
if (foundCounter == 0) {
System.out.println("Travel activity cannot be found!");
}*/
ArrayList<TravelActivity> found = new ArrayList<>();
for (TravelActivity activity: travelActivities){
if (activity.getPlan().toLowerCase().contains(activityNumber)){
found.add(activity);
}
}
travelActivities.removeAll(found);
}
}

//@@author ChinYanXu
/**
* Obtains the description of the plan that we are looking for from the travel activity list
*
Expand Down
52 changes: 3 additions & 49 deletions src/main/java/seedu/omnitravel/ui/Ui.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,83 +57,38 @@ public static void printNumberTooLargeException(NumberFormatException exception)
System.out.println("Warning! " + exception.getMessage() + " number too large!");
printLine();
}

//@@author ChenKangg
public static void helpCommand(){
printLine();
System.out.println("These are the available commands!");
System.out.println("");
System.out.println(
"1. list: List out the current list\n" +
"Format: `list`\n" +

"2. help: Get all commands for the chatbot\n" +
"Format: `help`\n" +

"3. bye: Exit the chatbot\n" +
"Format: `bye`\n" +

"4. add <travel activity> <date> <duration> <tag>\n" +
"Format: `add DESCRIPTION /date YYYY-MM-DD /duration DURATION [/tag TAG]`\n" +

"5. accommodation <travel activity> <date> <duration> <tag>\n" +
"Format: `accommodation DESCRIPTION /date YYYY-MM-DD /duration DURATION [/tag TAG]`\n" +

"6. food <travel activity> <date> <duration> <tag>\n" +
"Format: `food DESCRIPTION /date YYYY-MM-DD /duration DURATION [/tag TAG]`\n" +

"7. landmark <travel activity> <date> <duration> <tag>\n" +
"Format: `landmark DESCRIPTION /date YYYY-MM-DD /duration DURATION [/tag TAG]`\n" +

"8. delete <activity number>\n" +
"Format: `delete INDEX`\n" +

"9. find <keyword>\n" +
"Format: `find DESCRIPTION`\n" +

"10. check <activity number>\n" +
"Format: `check INDEX`\n" +

"11. uncheck <activity number>\n" +
"Format: `uncheck INDEX`\n" +

"12. tag <activity number> <tag name>\n" +
"Format: `tag INDEX TAGNAME`\n" +

"13. untag <activity number>\n" +
"Format: `untag INDEX`\n" +

"14. update <update> <date> <duration> <tag>\n" +
"Format: `update INDEX /date YYYY-MM-DD /duration DURATION [/tag TAG]`\n" +

"15. findtag <tag name>\n" +
"Format: `findtag TAG`\n" +

"16. findtype <type>\n" +
"Format: `findtype TYPE`\n" +

"17. expense <activity number> <expense amount>\n" +
"Format: `expense INDEX EXPENSE`\n" +

"18. removeexpense <activity number>\n" +
"Format: `removeexpense INDEX`\n" +

"19. totalexpense <type>\n" +
"Format: `totalexpense [/type TYPE]`\n" +

"20. change <amount> /from <current currency> /to <changed currency>\n" +
"Format: `change AMOUNT /from CODE /to CODE`\n" +

"21. location <activity number> <location>\n" +
"Format: `location INDEX LOCATION`\n" +

"22. removelocation <activity number>\n" +
"Format: `removelocation INDEX`\n" +

"23. findlocation <location>\n" +
"Format: `findlocation LOCATION`\n");
"23. findlocation <location>\n");
printLine();
}

//@@author ChenKangg
public static void printDateTimeExceptionError(){
System.out.println("Invalid date, please input the date in the following order: YYYY-MM-DD");
}
Expand All @@ -152,7 +107,6 @@ public static void printInterruptedError(){
* @param activityIndex The index of the activity
*/
public static void printActivity(TravelActivity activity, int activityIndex) {

String checked = activity.getActivityStatus()? "[X]" : "[ ]";
System.out.print(checked + " " + activityIndex + ". ");
if (activity.getClass().getSimpleName().equals("TravelActivity")){
Expand Down

0 comments on commit 584a8b4

Please sign in to comment.