From 0694d2187938accd6e0bfe64346b3bcda9efb053 Mon Sep 17 00:00:00 2001 From: techjay-c <> Date: Wed, 18 Oct 2023 01:40:31 +0800 Subject: [PATCH] Minor bug fix for search dentist command --- .../address/logic/commands/SearchDentistCommand.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/seedu/address/logic/commands/SearchDentistCommand.java b/src/main/java/seedu/address/logic/commands/SearchDentistCommand.java index a5f550df111..b9e32ef51d9 100644 --- a/src/main/java/seedu/address/logic/commands/SearchDentistCommand.java +++ b/src/main/java/seedu/address/logic/commands/SearchDentistCommand.java @@ -80,9 +80,13 @@ public CommandResult execute(Model model) { Predicate 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); + } else { + return new CommandResult("Dentist with dentist ID " + dentistID + " found."); + } } else { - return new CommandResult("Invalid search"); + return new CommandResult("No dentist with dentist ID 0"); } } return new CommandResult("Invalid search");