From 7629020bb2e7ffe5a90694ce542b5df23a73188b Mon Sep 17 00:00:00 2001 From: kaboomzxc Date: Wed, 27 Nov 2024 14:43:32 +0800 Subject: [PATCH 1/4] fix Typos in UG --- docs/UserGuide.md | 4 ++-- src/main/java/bookbob/functions/CommandHandler.java | 2 +- src/test/java/bookbob/functions/CommandHandlerTest.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 74d3f23e89..89a67bf9bd 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -254,7 +254,7 @@ Format: find Prefix/Value where Prefix can be: - mh/MEDICAL_HISTORY

**Note** :
-- Trailing spaces are fine, but there are no spaces anywhere in between Prefix/Value.
+- "find" Trims Leading spaces and Trailing spaces. But there are no spaces anywhere in between Prefix/Value.
Examples: * `find n/John` - Finds all patients whose names contain "John" @@ -321,7 +321,7 @@ Name: James Ho, NRIC: S9534567A, Phone: 80976890, Address: , DOB: , Allergy: [Po ``` Additional examples: -* `edit ic/S9890897U dob/31-01-1990 ha/Orchard Road` - Edit a patient record with optional fields in a different order than the format shown above. +* `edit ic/S9890897U /to dob/31-01-1990 ha/Orchard Road` - Edit a patient record with optional fields in a different order than the format shown above. The examples above result in successful patient record updates, which are automatically saved. diff --git a/src/main/java/bookbob/functions/CommandHandler.java b/src/main/java/bookbob/functions/CommandHandler.java index 847140328e..54945a081f 100644 --- a/src/main/java/bookbob/functions/CommandHandler.java +++ b/src/main/java/bookbob/functions/CommandHandler.java @@ -38,7 +38,7 @@ public void help() { +-------------+---------------------------------------+---------------------------------+ | Add | add n/NAME ic/NRIC [p/PHONE_NUMBER] | add n/James Ho ic/S9534567A | | | [d/DIAGNOSIS] [m/MEDICATION] | p/91234567 d/Asthma m/Albuterol | - | | [ha/HOME_ADDRESS] [dob/DATE_OF_BIRTH] | ha/NUS-PGPR dob/01011990 | + | | [ha/HOME_ADDRESS] [dob/DATE_OF_BIRTH] | ha/NUS-PGPR dob/21-05-1990 | | | [v/VISIT_DATE_TIME] [al/ALLERGY] | v/21-10-2024 15:48 al/Pollen | | | [s/SEX] [mh/MEDICALHISTORY] | s/Female mh/Diabetes | | | DATE format: dd-mm-yyyy | | diff --git a/src/test/java/bookbob/functions/CommandHandlerTest.java b/src/test/java/bookbob/functions/CommandHandlerTest.java index a5afdcb6de..8a9de9e355 100644 --- a/src/test/java/bookbob/functions/CommandHandlerTest.java +++ b/src/test/java/bookbob/functions/CommandHandlerTest.java @@ -48,7 +48,7 @@ void helpCommand_noInput_outputsCommandHelp() { "+-------------+---------------------------------------+---------------------------------+\n" + "| Add | add n/NAME ic/NRIC [p/PHONE_NUMBER] | add n/James Ho ic/S9534567A |\n" + "| | [d/DIAGNOSIS] [m/MEDICATION] | p/91234567 d/Asthma m/Albuterol |\n" + - "| | [ha/HOME_ADDRESS] [dob/DATE_OF_BIRTH] | ha/NUS-PGPR dob/01011990 |\n" + + "| | [ha/HOME_ADDRESS] [dob/DATE_OF_BIRTH] | ha/NUS-PGPR dob/21-05-1990 |\n" + "| | [v/VISIT_DATE_TIME] [al/ALLERGY] | v/21-10-2024 15:48 al/Pollen |\n" + "| | [s/SEX] [mh/MEDICALHISTORY] | s/Female mh/Diabetes |\n" + "| | DATE format: dd-mm-yyyy | |\n" + From 7e9b97f3b3d3f68caeeb5f91884253080821e974 Mon Sep 17 00:00:00 2001 From: kaboomzxc Date: Wed, 27 Nov 2024 14:54:34 +0800 Subject: [PATCH 2/4] fix CI --- .../bookbob/functions/CommandHandlerTest.java | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/test/java/bookbob/functions/CommandHandlerTest.java b/src/test/java/bookbob/functions/CommandHandlerTest.java index 8a9de9e355..64e69784cc 100644 --- a/src/test/java/bookbob/functions/CommandHandlerTest.java +++ b/src/test/java/bookbob/functions/CommandHandlerTest.java @@ -888,8 +888,8 @@ void editCommand_nricInputtedNotInRecord_noPatientFoundMessageGetsPrinted() thro //@@author G13nd0n @Test void testAppointment_onePatient_onePatient() throws IOException { - command.appointment("n/John Doe ic/S1234567A date/18-11-2024 time/18:00", appointmentRecord); - String expectedOutput = "Appointment on 18-11-2024 18:00 with Patient John Doe, S1234567A has been added."; + command.appointment("n/John Doe ic/S1234567A date/28-12-2024 time/18:00", appointmentRecord); + String expectedOutput = "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A has been added."; assertEquals(expectedOutput, outputStreamCaptor.toString().trim().replace(System.lineSeparator(), "\n")); } @@ -964,20 +964,20 @@ void editVisitCommand_editVisitDateOnlyWithCorrectInputFormat_editVisitSuccessfu //@@author G13nd0n @Test void testdeleteAppointment_onePatient_onePatient() throws IOException { - command.appointment("n/John Doe ic/S1234567A date/18-11-2024 time/18:00", appointmentRecord); - command.appointment("n/Helen Smith ic/S7654321A date/19-11-2024 time/18:00", appointmentRecord); - command.deleteAppointment("ic/S1234567A date/18-11-2024 time/18:00", appointmentRecord); + command.appointment("n/John Doe ic/S1234567A date/28-12-2024 time/18:00", appointmentRecord); + command.appointment("n/Helen Smith ic/S7654321A date/29-12-2024 time/18:00", appointmentRecord); + command.deleteAppointment("ic/S1234567A date/28-12-2024 time/18:00", appointmentRecord); assertEquals(1, appointmentRecord.getAppointments().size()); } //author G13nd0n @Test void testlistAppointment_noInput_multipleOutput() throws IOException { - command.appointment("n/John Doe ic/S1234567A date/18-11-2024 time/18:00", appointmentRecord); - command.appointment("n/Helen Smith ic/S7654321A date/19-11-2024 time/18:00", appointmentRecord); - String expectedOutput = "Appointment on 18-11-2024 18:00 with Patient John Doe, S1234567A has been added.\n" + - "Appointment on 19-11-2024 18:00 with Patient Helen Smith, S7654321A has been added.\n" + - "Appointment on 18-11-2024 18:00 with Patient John Doe, S1234567A.\n" + "Appointment on 19-11-2024 " + + command.appointment("n/John Doe ic/S1234567A date/28-12-2024 time/18:00", appointmentRecord); + command.appointment("n/Helen Smith ic/S7654321A date/29-12-2024 time/18:00", appointmentRecord); + String expectedOutput = "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A has been added.\n" + + "Appointment on 29-12-2024 18:00 with Patient Helen Smith, S7654321A has been added.\n" + + "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A.\n" + "Appointment on 19-11-2024 " + "18:00 with Patient Helen Smith, S7654321A."; command.listAppointments(appointmentRecord); assertEquals(expectedOutput, outputStreamCaptor.toString().trim().replace(System.lineSeparator(), @@ -987,11 +987,11 @@ void testlistAppointment_noInput_multipleOutput() throws IOException { //author G13nd0n @Test void testFindAppointment_name_oneOutput() throws IOException { - command.appointment("n/John Doe ic/S1234567A date/18-11-2024 time/18:00", appointmentRecord); - command.appointment("n/Helen Smith ic/S7654321A date/19-11-2024 time/18:00", appointmentRecord); - String expectedOutput = "Appointment on 18-11-2024 18:00 with Patient John Doe, S1234567A has been added.\n" + - "Appointment on 19-11-2024 18:00 with Patient Helen Smith, S7654321A has been added.\n" + - "Appointment on 18-11-2024 18:00 with Patient John Doe, S1234567A."; + command.appointment("n/John Doe ic/S1234567A date/28-12-2024 time/18:00", appointmentRecord); + command.appointment("n/Helen Smith ic/S7654321A date/29-12-2024 time/18:00", appointmentRecord); + String expectedOutput = "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A has been added.\n" + + "Appointment on 29-12-2024 18:00 with Patient Helen Smith, S7654321A has been added.\n" + + "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A."; command.findAppointment("n/John Doe", appointmentRecord); assertEquals(expectedOutput, outputStreamCaptor.toString().trim().replace(System.lineSeparator(), "\n")); @@ -1000,11 +1000,11 @@ void testFindAppointment_name_oneOutput() throws IOException { //author G13nd0n @Test void testFindAppointment_nric_oneOutput() throws IOException { - command.appointment("n/John Doe ic/S1234567A date/18-11-2024 time/18:00", appointmentRecord); - command.appointment("n/Helen Smith ic/S7654321A date/19-11-2024 time/18:00", appointmentRecord); - String expectedOutput = "Appointment on 18-11-2024 18:00 with Patient John Doe, S1234567A has been added.\n" + - "Appointment on 19-11-2024 18:00 with Patient Helen Smith, S7654321A has been added.\n" + - "Appointment on 18-11-2024 18:00 with Patient John Doe, S1234567A."; + command.appointment("n/John Doe ic/S1234567A date/28-12-2024 time/18:00", appointmentRecord); + command.appointment("n/Helen Smith ic/S7654321A date/29-12-2024 time/18:00", appointmentRecord); + String expectedOutput = "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A has been added.\n" + + "Appointment on 29-12-2024 18:00 with Patient Helen Smith, S7654321A has been added.\n" + + "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A."; command.findAppointment("ic/S1234567A", appointmentRecord); assertEquals(expectedOutput, outputStreamCaptor.toString().trim().replace(System.lineSeparator(), "\n")); @@ -1013,11 +1013,11 @@ void testFindAppointment_nric_oneOutput() throws IOException { //author G13nd0n @Test void testFindAppointment_date_oneOutput() throws IOException { - command.appointment("n/John Doe ic/S1234567A date/18-11-2024 time/18:00", appointmentRecord); - command.appointment("n/Helen Smith ic/S7654321A date/19-11-2024 time/18:00", appointmentRecord); - String expectedOutput = "Appointment on 18-11-2024 18:00 with Patient John Doe, S1234567A has been added.\n" + - "Appointment on 19-11-2024 18:00 with Patient Helen Smith, S7654321A has been added.\n" + - "Appointment on 18-11-2024 18:00 with Patient John Doe, S1234567A."; + command.appointment("n/John Doe ic/S1234567A date/28-12-2024 time/18:00", appointmentRecord); + command.appointment("n/Helen Smith ic/S7654321A date/29-12-2024 time/18:00", appointmentRecord); + String expectedOutput = "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A has been added.\n" + + "Appointment on 29-12-2024 18:00 with Patient Helen Smith, S7654321A has been added.\n" + + "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A."; command.findAppointment("date/18-11-2024", appointmentRecord); assertEquals(expectedOutput, outputStreamCaptor.toString().trim().replace(System.lineSeparator(), "\n")); @@ -1026,11 +1026,11 @@ void testFindAppointment_date_oneOutput() throws IOException { //author G13nd0n @Test void testFindAppointment_time_twoOutput() throws IOException { - command.appointment("n/John Doe ic/S1234567A date/18-11-2024 time/18:00", appointmentRecord); - command.appointment("n/Helen Smith ic/S7654321A date/19-11-2024 time/18:00", appointmentRecord); - String expectedOutput = "Appointment on 18-11-2024 18:00 with Patient John Doe, S1234567A has been added.\n" + - "Appointment on 19-11-2024 18:00 with Patient Helen Smith, S7654321A has been added.\n" + - "Appointment on 18-11-2024 18:00 with Patient John Doe, S1234567A.\n" + "Appointment on 19-11-2024 " + + command.appointment("n/John Doe ic/S1234567A date/28-12-2024 time/18:00", appointmentRecord); + command.appointment("n/Helen Smith ic/S7654321A date/29-12-2024 time/18:00", appointmentRecord); + String expectedOutput = "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A has been added.\n" + + "Appointment on 29-12-2024 18:00 with Patient Helen Smith, S7654321A has been added.\n" + + "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A.\n" + "Appointment on 19-11-2024 " + "18:00 with Patient Helen Smith, S7654321A."; command.findAppointment("time/18:00", appointmentRecord); assertEquals(expectedOutput, outputStreamCaptor.toString().trim().replace(System.lineSeparator(), From b5a046f8a694991308b12325525bb51e8bd855b5 Mon Sep 17 00:00:00 2001 From: kaboomzxc Date: Wed, 27 Nov 2024 14:58:33 +0800 Subject: [PATCH 3/4] fix CI --- src/test/java/bookbob/functions/CommandHandlerTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/bookbob/functions/CommandHandlerTest.java b/src/test/java/bookbob/functions/CommandHandlerTest.java index 64e69784cc..c6c4ec9700 100644 --- a/src/test/java/bookbob/functions/CommandHandlerTest.java +++ b/src/test/java/bookbob/functions/CommandHandlerTest.java @@ -977,7 +977,7 @@ void testlistAppointment_noInput_multipleOutput() throws IOException { command.appointment("n/Helen Smith ic/S7654321A date/29-12-2024 time/18:00", appointmentRecord); String expectedOutput = "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A has been added.\n" + "Appointment on 29-12-2024 18:00 with Patient Helen Smith, S7654321A has been added.\n" + - "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A.\n" + "Appointment on 19-11-2024 " + + "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A.\n" + "Appointment on 19-12-2024 " + "18:00 with Patient Helen Smith, S7654321A."; command.listAppointments(appointmentRecord); assertEquals(expectedOutput, outputStreamCaptor.toString().trim().replace(System.lineSeparator(), @@ -1018,7 +1018,7 @@ void testFindAppointment_date_oneOutput() throws IOException { String expectedOutput = "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A has been added.\n" + "Appointment on 29-12-2024 18:00 with Patient Helen Smith, S7654321A has been added.\n" + "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A."; - command.findAppointment("date/18-11-2024", appointmentRecord); + command.findAppointment("date/18-12-2024", appointmentRecord); assertEquals(expectedOutput, outputStreamCaptor.toString().trim().replace(System.lineSeparator(), "\n")); } @@ -1030,7 +1030,7 @@ void testFindAppointment_time_twoOutput() throws IOException { command.appointment("n/Helen Smith ic/S7654321A date/29-12-2024 time/18:00", appointmentRecord); String expectedOutput = "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A has been added.\n" + "Appointment on 29-12-2024 18:00 with Patient Helen Smith, S7654321A has been added.\n" + - "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A.\n" + "Appointment on 19-11-2024 " + + "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A.\n" + "Appointment on 19-12-2024 " + "18:00 with Patient Helen Smith, S7654321A."; command.findAppointment("time/18:00", appointmentRecord); assertEquals(expectedOutput, outputStreamCaptor.toString().trim().replace(System.lineSeparator(), From b66b9a3217fa170b1db15f14c019c47d5e27208f Mon Sep 17 00:00:00 2001 From: kaboomzxc Date: Wed, 27 Nov 2024 15:01:25 +0800 Subject: [PATCH 4/4] fix CI --- src/test/java/bookbob/functions/CommandHandlerTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/bookbob/functions/CommandHandlerTest.java b/src/test/java/bookbob/functions/CommandHandlerTest.java index c6c4ec9700..868d62e639 100644 --- a/src/test/java/bookbob/functions/CommandHandlerTest.java +++ b/src/test/java/bookbob/functions/CommandHandlerTest.java @@ -977,7 +977,7 @@ void testlistAppointment_noInput_multipleOutput() throws IOException { command.appointment("n/Helen Smith ic/S7654321A date/29-12-2024 time/18:00", appointmentRecord); String expectedOutput = "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A has been added.\n" + "Appointment on 29-12-2024 18:00 with Patient Helen Smith, S7654321A has been added.\n" + - "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A.\n" + "Appointment on 19-12-2024 " + + "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A.\n" + "Appointment on 29-12-2024 " + "18:00 with Patient Helen Smith, S7654321A."; command.listAppointments(appointmentRecord); assertEquals(expectedOutput, outputStreamCaptor.toString().trim().replace(System.lineSeparator(), @@ -1018,7 +1018,7 @@ void testFindAppointment_date_oneOutput() throws IOException { String expectedOutput = "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A has been added.\n" + "Appointment on 29-12-2024 18:00 with Patient Helen Smith, S7654321A has been added.\n" + "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A."; - command.findAppointment("date/18-12-2024", appointmentRecord); + command.findAppointment("date/28-12-2024", appointmentRecord); assertEquals(expectedOutput, outputStreamCaptor.toString().trim().replace(System.lineSeparator(), "\n")); } @@ -1030,7 +1030,7 @@ void testFindAppointment_time_twoOutput() throws IOException { command.appointment("n/Helen Smith ic/S7654321A date/29-12-2024 time/18:00", appointmentRecord); String expectedOutput = "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A has been added.\n" + "Appointment on 29-12-2024 18:00 with Patient Helen Smith, S7654321A has been added.\n" + - "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A.\n" + "Appointment on 19-12-2024 " + + "Appointment on 28-12-2024 18:00 with Patient John Doe, S1234567A.\n" + "Appointment on 29-12-2024 " + "18:00 with Patient Helen Smith, S7654321A."; command.findAppointment("time/18:00", appointmentRecord); assertEquals(expectedOutput, outputStreamCaptor.toString().trim().replace(System.lineSeparator(),