Skip to content

Commit

Permalink
Merge pull request #224 from daryltay415/master
Browse files Browse the repository at this point in the history
Update user guide
  • Loading branch information
EugeneChanJiajun authored Apr 12, 2024
2 parents d6dfa93 + 2a04ae1 commit 0c649c7
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 6 deletions.
6 changes: 4 additions & 2 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,12 @@ ____________________________________________________________

Find an activity based on their tag. All activities with the given tag will be listed out.

Format: `findtag TAG`
Format: `findtag TAG [/exclude KEYWORD]`
* `TAG` has to match the activity tag exactly to find the activity

Examples of usage:
* `findtag spicy`
* `findtag spicy /exclude mala`

Expected outcome:
```
Expand Down Expand Up @@ -411,12 +412,13 @@ ____________________________________________________________

Find an activity based on their type. All activities with the given type will be listed out.

Format: `findtype TYPE`
Format: `findtype TYPE [/exclude KEYWORD]`
* `TYPE` has to match the activity type exactly to find the activity
* The different types are `general`, `accommodation`, `food`, `landmark`

Examples of usage:
* `findtype general`
* `findtype general /exclude japan`

Expected outcome:
```
Expand Down
2 changes: 0 additions & 2 deletions omni.txt
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
general / 0 / go to paris / 2025-12-12 / 2 weeks / /
general / 0 / go to france / 2025-12-12 / 2 weeks / /
4 changes: 2 additions & 2 deletions src/main/java/seedu/omnitravel/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ public static void deleteCommand(String[] command, TravelActivityList list, Stri
int input = Integer.parseInt(command[1]);
list.removeTravelActivity(input);
} catch (NumberFormatException e) {
int IndexOfDescription = line.indexOf(command[1]);
String description = line.substring(IndexOfDescription);
int indexOfDescription = line.indexOf(command[1]);
String description = line.substring(indexOfDescription);
list.removeTravelActivity(description);
}
}
Expand Down
70 changes: 70 additions & 0 deletions src/test/java/seedu/omnitravel/OmniTravelTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -602,4 +602,74 @@ public void testHandleException() {
public void testAsciiCheck() throws OmniException {
CheckParameters.asciiCheck("Valid input");
}

@Test
public void testGetListMethod() throws OmniException {
TravelActivityList list = new TravelActivityList();
list.addTravelActivity(accommodationNew1);
Parser.getList("list", list);
}

@Test
public void testGetListMethodWithSorting() throws OmniException{
TravelActivityList list = new TravelActivityList();
list.addTravelActivity(accommodationNew1);
list.addTravelActivity(foodNew2);
Parser.getList("list /sort", list);
}

@Test
public void testGetListMethodWithDate() throws OmniException{
TravelActivityList list = new TravelActivityList();
list.addTravelActivity(accommodationNew1);
list.addTravelActivity(foodNew2);
Parser.getList("list /date 2025-12-12 ", list);
}

@Test
public void testAddCommandMethod() throws OmniException{
TravelActivityList list = new TravelActivityList();
// Test case without tags
Parser.addCommand("add home /date 2026-12-12 /duration 2 days", list);
// Test case with tags
Parser.addCommand("add home /date 2026-12-12 /duration 2 days /tag first", list);
}

@Test
public void testDeleteCommandMethod() throws OmniException{
TravelActivityList list = new TravelActivityList();
list.addTravelActivity(accommodationNew1);
list.addTravelActivity(foodNew2);
String[] command1 = {"delete", "1"};
String[] command2 = {"delete", "pgpr mala"};
Parser.deleteCommand(command1, list, "delete 1");
Parser.deleteCommand(command2, list, "delete pgpr mala");
}

@Test
public void testCheckCommandMethod() throws OmniException{
TravelActivityList list = new TravelActivityList();
list.addTravelActivity(accommodationNew1);
list.addTravelActivity(foodNew2);
String[] command = {"check", "1"};
Parser.checkCommand(command, list);
}

@Test
public void testUncheckCommandMethod() throws OmniException{
TravelActivityList list = new TravelActivityList();
list.addTravelActivity(accommodationNew1);
list.addTravelActivity(foodNew2);
String[] command = {"uncheck", "1"};
Parser.uncheckCommand(command, list);
}

@Test
public void testListTagsCommandMethod() throws OmniException{
TravelActivityList list = new TravelActivityList();
list.addTravelActivity(accommodationNew1);
list.addTravelActivity(foodNew2);
String[] command = {"listtags"};
Parser.listTagsCommand(command, list);
}
}

0 comments on commit 0c649c7

Please sign in to comment.