Skip to content

Commit

Permalink
Merge pull request #236 from ChinYanXu/LineCoverageAndPPP
Browse files Browse the repository at this point in the history
Improve Line coverage and Update chinyanxu.md
  • Loading branch information
daryltay415 authored Apr 15, 2024
2 parents 683bb3c + 6470f7b commit 5c924d3
Show file tree
Hide file tree
Showing 7 changed files with 483 additions and 69 deletions.
59 changes: 45 additions & 14 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,21 @@ ____________________________________________________________
```

### 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.
Find activities based on their description. All activities with the given description will be listed out.

Format: `find DESCRIPTION [/exclude KEYWORD]`
* `DESCRIPTION` has to match the activity description exactly to find the activity
* `DESCRIPTION` can also be a keyword that is included in the description.
* `/exclude KEYWORD` will exclude any keywords that appear in the resulting list based on what your description is.

Examples of usage (assuming saizeriya is in list):
* `DESCRIPTION` has to be a word, a phrase or a segment of the activity description to find the activity
* `KEYWORD` has to be a word, a phrase or a segment of the activity description to exclude the activity
* `/exclude KEYWORD` will exclude any activity with `KEYWORD` found in the **description** of the activity

Examples of usage (assuming saizeriya is in list):
* `find saizeriya`
* `find saizeriya /exclude pizza`

Expected outcome:
Without `/exclude`

Expected output:
```
____________________________________________________________
Here are what you are looking for:
Expand All @@ -188,9 +192,7 @@ ____________________________________________________________
```

With `/exclude`:
* `find saizeriya /exclude pizza`

Expected output:
```
____________________________________________________________
Here are what you are looking for:
Expand All @@ -210,17 +212,22 @@ Examples of usage:
* `delete 1`
* `delete Eiffel`

Expected output:
Expected outcome:
When ACTIVITY is a number
```
____________________________________________________________
I have removed this activity:
Accommodation: Four Seasons Hotel :14 Mar 2025 :2 days
1. Accommodation: Four Seasons Hotel :14 Mar 2025 :2 days
____________________________________________________________
```

When ACTIVITY is a keyword
```
____________________________________________________________
I have removed this activity:
1. Landmark: Eiffel Tower :14 Mar 2025 :2 hours (go up tower)
2. Landmark: Eiffel Tower Food Stand :14 Mar 2025 :1 hours (dinner)
3. Accommodation: Hotel beside Eiffel Tower :14 Mar 2025 :2 days (rest)
____________________________________________________________
```

Expand Down Expand Up @@ -378,18 +385,30 @@ ____________________________________________________________
Find an activity based on their tag. All activities with the given tag will be listed out.

Format: `findtag TAG [/exclude KEYWORD]`
* `TAG` has to match the activity tag exactly to find the activity
* `/exclude KEYWORD` will exclude any keywords found in the **description** of the activity

* `TAG` has to be a word, a phrase or a segment of the activity description to find the activity
* `KEYWORD` has to be a word, a phrase or a segment of the activity description to exclude the activity
* `/exclude KEYWORD` will exclude any activity with `KEYWORD` found in the **description** of the activity

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

Expected outcome:
Without `/exclude`
```
____________________________________________________________
Here are what you are looking for:
[ ] 1. Food: Mala Hotpot :14 Mar 2025 :2 hours (very spicy)
[ ] 2. Food: McSpicy :16 Mar 2025 :1 hour (very spicy)
____________________________________________________________
```

With `/exclude`
```
____________________________________________________________
Here are what you are looking for:
[ ] 1. Food: McSpicy :16 Mar 2025 :1 hour (very spicy)
____________________________________________________________
```

Expand Down Expand Up @@ -419,15 +438,18 @@ ____________________________________________________________
Find an activity based on their type. All activities with the given type will be listed out.

Format: `findtype TYPE [/exclude KEYWORD]`
* `TYPE` has to match the activity type exactly to find the activity
* `TYPE` has to be a word, a phrase or a segment of the activity description to find the activity
* `KEYWORD` has to be a word, a phrase or a segment of the activity description to exclude the activity
* The different types are `general`, `accommodation`, `food`, `landmark`
* `/exclude KEYWORD` will exclude any keywords found in the **description** of the activity
* `/exclude KEYWORD` will exclude any activity with `KEYWORD` found in the **description** of the activity

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

Expected outcome:

Without `/exclude`
```
____________________________________________________________
Here are what you are looking for:
Expand All @@ -436,6 +458,15 @@ Here are what you are looking for:
____________________________________________________________
```

With `/exclude`
```
____________________________________________________________
Here are what you are looking for:
[ ] 1. 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.
Expand Down
47 changes: 32 additions & 15 deletions docs/team/chinyanxu.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,42 @@ to quickly group and retrieve information.
### Summary of Contributions
Given below are my contributions to the project.

* New Feature: Added the find, findtag and findtype command
* What it does: Enables the user to sort and display all the travel activities stored in Omnitravel or only display
* travel activities of certain types or with certain tags.
* Users are able to exclude travel activities with certain keywords from being displayed while searching

* New Feature: Added the find command [#25](https://github.com/AY2324S2-CS2113-T12-4/tp/pull/25)
* What it does: Enables the user to display all the travel activities stored in Omnitravel containing a certain
keyword in their description
* Justification: User might only want to see a list of certain activities and this feature will enable them to do so.
* Highlights: User can use the `/exclude KEYWORD` optional inputs to further filter out what they want to see it their
search
* New Feature: Added the findtag command [#89](https://github.com/AY2324S2-CS2113-T12-4/tp/pull/89)
* What it does: Enables the user to display all the travel activities stored in Omnitravel containing a certain tag
* Justification: User might have tagged each activity to categorise them and might want to see which activity belongs
to a tag. This feature enables them to do so.
* Highlights: User can use the `/exclude KEYWORD` optional inputs to further filter out what they want to see it their
search
* New Feature: Added the findtype command [#91](https://github.com/AY2324S2-CS2113-T12-4/tp/pull/91)
* What it does: Enables the user to display all the travel activities stored in Omnitravel of a certain type
* Justification: User might have sorted each activity into their respective types and might want to see which
activity is under a type. This feature enables them to do so.
* Highlights: User can use the `/exclude KEYWORD` optional inputs to further filter out what they want to see it their
search

#### Code contribution:
[RepoSense link]
https://nus-cs2113-ay2324s2.github.io/tp-dashboard/?search=chinyanxu&breakdown=true
[RepoSense link](https://nus-cs2113-ay2324s2.github.io/tp-dashboard/?search=chinyanxu&breakdown=true)

* Enhancements implemented to existing features
* Added a way to delete travel activities from the list using keywords instead of just the index of the travel
* activity
* Implemented a way to test System.out.println output on numerous JUnit tests

* Added a way to delete travel activities from the list using keywords instead of just the index of the travel
activity [#211](https://github.com/AY2324S2-CS2113-T12-4/tp/pull/211)
* Documentation
* User Guide:
* Added documentation for feature `find`, `findtag` and `findtype`
* Added documentation for delete by keyword enhancement

* Added documentation for feature `find` [#127](https://github.com/AY2324S2-CS2113-T12-4/tp/pull/127)
* Added documentation for feature `findtag` [#127](https://github.com/AY2324S2-CS2113-T12-4/tp/pull/127)
* Added documentation for feature `findtype` [#127](https://github.com/AY2324S2-CS2113-T12-4/tp/pull/127)
* Added documentation for delete by keyword enhancement [#211](https://github.com/AY2324S2-CS2113-T12-4/tp/pull/211)
* Developer Guide:
* Added OmniTravel value proposition.
* Added OmniTravel value proposition. [#92](https://github.com/AY2324S2-CS2113-T12-4/tp/pull/92)
* Community:
* Suggested fixes for other teams in the forum [#38](https://github.com/nus-cs2113-AY2324S2/forum/issues/38)
* Contributions to team-based-tasks
* Contributed large portions of the JUnit tests [#236](https://github.com/AY2324S2-CS2113-T12-4/tp/pull/236)
* Implemented a way to test text outputted to console [#92](https://github.com/AY2324S2-CS2113-T12-4/tp/pull/92)
* Implemented a way to test if an exception is triggered [#236](https://github.com/AY2324S2-CS2113-T12-4/tp/pull/236)
3 changes: 3 additions & 0 deletions src/main/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: seedu.omnitravel.omnitravel.OmniTravel

3 changes: 2 additions & 1 deletion src/main/java/seedu/omnitravel/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ public static void tagCommand(String line, TravelActivityList list) throws OmniE
* @throws OmniException if command.length != 2 && command[1] is not numeric
*/
public static void removeTagCommand(String[] command, TravelActivityList list) throws OmniException {
assert command != null && command.length >= 2 : "Command array should not be null or empty";
assert command != null && command.length >= 2 : "Command array should not be null, empty or longer than " +
"length 2";
assert list != null : "TravelActivityList should not be null";

logger.log(Level.INFO, "Remove tag command: " + Arrays.toString(command));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ public int getNoOfTravelActivities(){

//@@author ChinYanXu
/**
* Removes travel activity from the travel activity list
* @param activityNumber The travel activity index number or description on the list
* Removes travel activity from the travel activity list using the travel activity index number
*
* @param activityNumber The index number of the travel activity that the user wants to remove
*/


public void removeTravelActivity(int activityNumber) throws OmniException {
assert activityNumber != 0 : "There is not activities in the list";
assert activityNumber != 0 : "There is no activities in the list";
int indexOfActivity = activityNumber - 1;
int initialListSize = noOfActivities;
if(activityNumber > noOfActivities){
Expand All @@ -116,6 +116,13 @@ public void removeTravelActivity(int activityNumber) throws OmniException {
assert newSize == initialListSize - 1 : "There is an error with list size!";
}

/**
* Overloaded version of removeTravelActivity function to enable user to remove travel activities from the travel
* activity list using the travel activity description
*
* @param activity The description of travel activity that the user wants to remove
*/

public void removeTravelActivity(String activity){
int foundCounter = 0;
for (int iterator = 0; iterator < travelActivities.size(); iterator += 1) {
Expand Down Expand Up @@ -153,14 +160,12 @@ public String getDescription(String plan){
}
//@@author ChinYanXu
/**
* Finds all activities in the TravelActivity list that contains a keyword specified
* by the user.
* Finds all activities in the TravelActivity list that contains a keyword specified by the user.
*
* @param activityName keyword specified by the user to find activities in the TravelActivity list
* related to the keyword.
* @param activityName keyword specified by the user to find travel activities in the TravelActivity list
* with description related to the keyword.
*/


public void searchKeyword (String activityName) {
int foundCounter = 0;
for (TravelActivity travelActivity : travelActivities) {
Expand All @@ -180,10 +185,11 @@ public void searchKeyword (String activityName) {
}

/**
* Overloaded version of searchKeyword function to enable user to exclude certain activities from their search
* Overloaded version of searchKeyword function to enable user to exclude certain travel activities from their
* search
*
* @param activityName The description of tasks that the user wants to find
* @param exclusion The keyword that the user uses to remove unwanted results from the search
* @param activityName The description of the travel activities that the user wants to find
* @param exclusion The keyword that the travel activities uses to remove unwanted results from the search
*/

public void searchKeyword (String activityName, String exclusion) {
Expand Down Expand Up @@ -334,9 +340,9 @@ public ArrayList<TravelActivity> getTravelActivities () {

//@@author ChinYanXu
/**
* Find all the tasks with a particular tag and prints them out
* Find all the travel activities with a particular tag and prints them out
*
* @param tag The tag of tasks that the user wants to find
* @param tag The tag of travel activities that the user wants to find
*/

public void findTag(String tag){
Expand All @@ -358,9 +364,9 @@ public void findTag(String tag){
}

/**
* Overloaded version of findtag function to enable user to exclude certain activities from their search
* Overloaded version of findtag function to enable user to exclude certain travel activities from their search
*
* @param tag The tag of tasks that the user wants to find
* @param tag The tag of the travel activities that the user wants to find
* @param exclude The keyword that the user uses to remove unwanted results from the search
*/

Expand All @@ -384,9 +390,9 @@ public void findTag(String tag, String exclude){
}

/**
* Find all the tasks of a particular type and prints them out
* Find all the travel activities of a particular type and prints them out
*
* @param type The type of tasks that the user wants to find
* @param type The type of travel activities that the user wants to find
*/

public void findType(String type){
Expand All @@ -403,15 +409,15 @@ public void findType(String type){
}
}
if (foundCounter == 0) {
System.out.println("Sorry I could not find what you are looking for.");
System.out.println("Sorry, I could not find what you are looking for.");
}
}

//@@author ChenKangg
/**
* Overloaded version of findtype to enable user to exclude certain activities from their search
*
* @param type The type of tasks that the user wants to find
* @param type The type of travel activities that the user wants to find
* @param exclude The keyword that the user uses to remove unwanted results from the search
*
*/
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/seedu/omnitravel/ui/Ui.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,27 @@ public static void helpCommand(){
printLine();
}

/**
* Prints out the error message for when the user inputs the date in the wrong format
*/

//@@author daryltay415
public static void printDateTimeExceptionError(){
System.out.println("Invalid date, please input the date in the following order: YYYY-MM-DD");
}

/**
* Prints out the error message for when there is an error when saving the file
*/

public static void printSavingError(){
System.out.println("Something went wrong when saving the file");
}

/**
* Prints out the error message for when InterruptedException is thrown
*/

public static void printInterruptedError(){
System.out.println("Warning Website might be down!");
}
Expand Down
Loading

0 comments on commit 5c924d3

Please sign in to comment.