Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/AY2324S2-CS2103T-F10-1/tp
Browse files Browse the repository at this point in the history
…into branch-update-help-command
  • Loading branch information
iamtr committed Apr 9, 2024
2 parents e3b58d3 + 7c82261 commit 455fbca
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/main/java/seedu/address/logic/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class Messages {
public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The person index provided is invalid";
public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d persons listed!";
public static final String MESSAGE_PERSON_LISTED_OVERVIEW = "%1$d person listed!";
public static final String MESSAGE_DUPLICATE_FIELDS =
"Multiple values specified for the following single-valued field(s): ";

Expand Down
7 changes: 5 additions & 2 deletions src/main/java/seedu/address/logic/commands/FindCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ public FindCommand(Predicate<Person> predicate) {
public CommandResult execute(Model model) {
requireNonNull(model);
model.updateFilteredPersonList(predicate);
return new CommandResult(
String.format(Messages.MESSAGE_PERSONS_LISTED_OVERVIEW, model.getFilteredPersonList().size()));
int listSize = model.getFilteredPersonList().size();
if (listSize < 2) {
return new CommandResult(String.format(Messages.MESSAGE_PERSON_LISTED_OVERVIEW, listSize));
}
return new CommandResult(String.format(Messages.MESSAGE_PERSONS_LISTED_OVERVIEW, listSize));
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/person/Ic.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
public class Ic {
public static final String MESSAGE_CONSTRAINTS =
"ICs starts with a capital letter, followed by a 7 digit number and ends with a capital letter."
"ICs starts with a capital letter, followed by a 7 digit number and ends with a capital letter. "
+ "It should not be blank.";

// Singapore regex for ic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static seedu.address.logic.Messages.MESSAGE_PERSONS_LISTED_OVERVIEW;
import static seedu.address.logic.Messages.MESSAGE_PERSON_LISTED_OVERVIEW;
import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess;
import static seedu.address.testutil.TypicalPersons.CARL;
import static seedu.address.testutil.TypicalPersons.ELLE;
Expand Down Expand Up @@ -56,7 +57,7 @@ public void equals() {

@Test
public void execute_zeroKeywords_noPersonFound() {
String expectedMessage = String.format(MESSAGE_PERSONS_LISTED_OVERVIEW, 0);
String expectedMessage = String.format(MESSAGE_PERSON_LISTED_OVERVIEW, 0);
NameContainsKeywordsPredicate predicate = preparePredicate(" ");
FindCommand command = new FindCommand(predicate);
expectedModel.updateFilteredPersonList(predicate);
Expand Down

0 comments on commit 455fbca

Please sign in to comment.