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

Branch update find command format #69

Conversation

yooplo
Copy link

@yooplo yooplo commented Oct 15, 2024

Update find command tag from '/' to '/'

Improved finding to include results with partial matches

Include additional test cases

Closes #63

original was /<tag>
now is <tag>/

To make it in uniform with the other commands
Include additional test cases
@yooplo yooplo added this to the v1.3 milestone Oct 15, 2024
@yooplo yooplo linked an issue Oct 15, 2024 that may be closed by this pull request
@yooplo yooplo self-assigned this Oct 15, 2024
Copy link

@KrashKart KrashKart left a comment

Choose a reason for hiding this comment

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

LGTM! This should:

  • establish the correct find command format
  • implement a less strict find protocol for all 3 FindCommands

@@ -17,7 +16,7 @@ public ContactContainsKeywordsPredicate(List<String> keywords) {
@Override
public boolean test(Person person) {
return this.getKeywords().stream()
.anyMatch(keyword -> StringUtil.containsWordIgnoreCase(person.getPhone().value, keyword));
.anyMatch(keyword -> person.getPhone().value.toLowerCase().contains(keyword.toLowerCase()));
}

@Override

Choose a reason for hiding this comment

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

Can keep in view to possibly abstract the test method into the superclass FindCommand if we decide to extend the logic

return new FindByContactCommand(
new ContactContainsKeywordsPredicate(Arrays.asList(searchTermArray)));
case "/e":
case "e/":
return new FindByEmailCommand(
new EmailContainsKeywordsPredicate(Arrays.asList(searchTermArray)));
default:

Choose a reason for hiding this comment

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

Can keep in view to shorten the code here by establishing Arrays.asList(....) outside the switch so we do not have to type this 3 times

@KrashKart KrashKart merged commit c600cef into AY2425S1-CS2103T-F14a-4:master Oct 15, 2024
8 checks passed
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.

Update the "FindBy" command formats to be uniform with the other commands
2 participants