Skip to content

Commit

Permalink
Minor bug fix for search dentist command
Browse files Browse the repository at this point in the history
  • Loading branch information
techjay-c committed Oct 17, 2023
1 parent 95c15f6 commit 0694d21
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,13 @@ public CommandResult execute(Model model) {
Predicate<Dentist> dentistIdPredicate = dentist -> dentist.getId() == dentistID;
model.updateFilteredDentistList(dentistIdPredicate);

return new CommandResult("Dentist search for ID " + dentistID + " found.");
if (model.getFilteredDentistList().isEmpty()) {
return new CommandResult("No dentist found with dentist ID " + dentistID);

Check warning on line 84 in src/main/java/seedu/address/logic/commands/SearchDentistCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/SearchDentistCommand.java#L84

Added line #L84 was not covered by tests
} else {
return new CommandResult("Dentist with dentist ID " + dentistID + " found.");

Check warning on line 86 in src/main/java/seedu/address/logic/commands/SearchDentistCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/SearchDentistCommand.java#L86

Added line #L86 was not covered by tests
}
} else {
return new CommandResult("Invalid search");
return new CommandResult("No dentist with dentist ID 0");

Check warning on line 89 in src/main/java/seedu/address/logic/commands/SearchDentistCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/SearchDentistCommand.java#L89

Added line #L89 was not covered by tests
}
}
return new CommandResult("Invalid search");
Expand Down

0 comments on commit 0694d21

Please sign in to comment.