Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Defensive] FindCommand #180

Merged

Conversation

underthehai
Copy link
Collaborator

Include check to ensure wishlist can only find activity object
Assert valid inputs
close #163

@underthehai underthehai added this to the v1.3 milestone Oct 27, 2020
@underthehai underthehai changed the title [Defensive] find command [Defensive] FindCommand Oct 27, 2020
Copy link
Collaborator

@jeannetoh99 jeannetoh99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just some comments!

@@ -20,6 +20,7 @@
public static final String MESSAGE_ACTIVITIES_LISTED_OVERVIEW = "%1$d activities listed!";
public static final String MESSAGE_ACCOMMODATIONS_LISTED_OVERVIEW = "%1$d accommodations listed!";
public static final String MESSAGE_FRIENDS_LISTED_OVERVIEW = "%1$d friends listed!";
public static final String MESSAGE_TRAVELPLANS_LISTED_OVERVIEW = "%1$d travel plans listed!";
public static final String WRONG_DIRECTORY = "You are currently in the wishlist which can only find activity.\n"
+ "Please goto to a travelplan to edit friend, activity or accommodation";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a clearer phrasing?
"Please go to your desired travelplan to edit friend, activity or accommodation, using the goto command.";


private final NameContainsKeywordsPredicate predicate;
private final int travelPlanObjectType;

/**
* Constructor for FindCommand
*
* @param predicate contains a list of strings to filter travel plan object list
* @param predicate contains a list of strings to filter travel plan object list
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you accidentally added a big space here haha

Comment on lines 67 to 85
if (this.travelPlanObjectType == ParserUtil.ACTIVITY_INDEX) {
model.updateFilteredActivityList(predicate);
message = MESSAGE_ACTIVITIES_LISTED_OVERVIEW;
size = model.getFilteredActivityList().size();

} else if (this.travelPlanObjectType == 1) { //accommodation
} else if (this.travelPlanObjectType == ParserUtil.ACCOMMODATION_INDEX) {
model.updateFilteredAccommodationList(predicate);
message = MESSAGE_ACCOMMODATIONS_LISTED_OVERVIEW;
size = model.getFilteredAccommodationList().size();


} else if (this.travelPlanObjectType == 2) { //friend
} else if (this.travelPlanObjectType == ParserUtil.FRIEND_INDEX) {
model.updateFilteredFriendList(predicate);
message = MESSAGE_FRIENDS_LISTED_OVERVIEW;
size = model.getFilteredFriendList().size();

} else {
assert false;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use switch case but not a big problem.


private final NameContainsKeywordsPredicate predicate;
private final int travelPlanObjectType;

/**
* Constructor for FindCommand
*
* @param predicate contains a list of strings to filter travel plan object list
* @param predicate contains a list of strings to filter travel plan object list
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there a huge whitespace here tho?

@jiaweiteo jiaweiteo removed this from the v1.3 milestone Oct 28, 2020
@lyeyixian lyeyixian added this to the v1.4 milestone Oct 28, 2020
Copy link

@jiaweiteo jiaweiteo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jiaweiteo jiaweiteo merged commit db98488 into AY2021S1-CS2103-T14-3:master Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Defensive] Find Command
4 participants