From 18fae84c4390aef955c648da47c18e4320f31b81 Mon Sep 17 00:00:00 2001 From: jskimdev Date: Mon, 15 Apr 2024 23:45:34 +0800 Subject: [PATCH] Add page break --- docs/UserGuide.md | 20 +++++++ .../logic/parser/EditCommandParser.java | 53 +++++++++---------- 2 files changed, 45 insertions(+), 28 deletions(-) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index b8f4ea784bc..87f79d79bad 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -14,6 +14,9 @@ MediTrack stands at the forefront of healthcare technology, offering an intuitiv The purpose of this User Guide is multifaceted. Primarily, it serves as an educational tool, introducing you to the myriad features and functionalities of MediTrack. Whether you are a first-time user or looking to deepen your understanding of more advanced features, this guide is tailored to meet your needs. It provides step-by-step instructions, best practices, and troubleshooting advice to ensure that you can navigate the application with ease and confidence. + +
+ @@ -46,6 +49,8 @@ The purpose of this User Guide is multifaceted. Primarily, it serves as an educa -------------------------------------------------------------------------------------------------------------------- +
+ ## Features @@ -133,6 +138,9 @@ Format: `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS b/DATE_OF_BIRTH s/Sex` Example: * `add n/John Doe p/98765432 e/johnd@example.com a/John street, block 123, #01-01 b/2001-1-1 s/Male` +
+ + ### Adding a visit to a patient: `addv` Adds a visit to a patient. @@ -169,6 +177,9 @@ Shows a list of all patients in the patient list in order of appointment. Format: `list-by-date` +
+ + ### Listing all patients whose appointments fall or on before a certain date : `list-until-date` Shows a list of all patients in the patient list whose appointments fall on or before the given date. @@ -193,6 +204,8 @@ Example: * `edit 2 n/Betsy Crower` Edits the name of the 2nd patient to be `Betsy Crower`. * `edit n/Alex Yeoh p/88472848 n/Eugene` Edits the name of patient from `Alex Yeoh` to `Eugene`. +
+ ### Editing the latest visit of a patient: `editv` Edits the displayed visit of a patient. @@ -257,6 +270,8 @@ Format: `delete-p n/NAME p/PHONE_NUMBER` Example: * `delete n/Eugene Hirose p/90807561` Deletes the patient with name exactly the same as "Eugene Hirose" and phone number exactly the same as "90807561". +
+ ### Deleting all entries : `delete-all` Deletes all patients' information in the patientlist.json. @@ -293,6 +308,8 @@ Example: * `deletev 1` * `deletev n/Alex Yeoh p/87438807` +
+ ### Exiting the program : `exit` Lets the system know the user wants to exit the program. @@ -323,6 +340,9 @@ If your changes to the data file makes its format invalid, MediTrack will discar Furthermore, certain edits can cause the MediTrack to behave in unexpected ways (e.g., if a value entered is outside the acceptable range). Therefore, edit the data file only if you are confident that you can update it correctly.
+
+ + ## FAQ **Q**: How do I transfer my data to another Computer?
diff --git a/src/main/java/seedu/address/logic/parser/EditCommandParser.java b/src/main/java/seedu/address/logic/parser/EditCommandParser.java index b8b9453706f..c605796dc5c 100644 --- a/src/main/java/seedu/address/logic/parser/EditCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/EditCommandParser.java @@ -46,40 +46,37 @@ public EditCommand parse(String args) throws ParseException { } private EditCommand parseStringWithNameAndPhone(String[] splitMessages) throws ParseException { - try { - String namePrefix = splitMessages[0].substring(2) + " "; - String phonePrefix = ""; - String rest = " "; - Boolean isNameFilled = false; - Boolean isPhoneFilled = false; - - for (int i = 1; i < splitMessages.length; i++) { - if (!isNameFilled && splitMessages[i].substring(0, 2).equals("p/") && !isPhoneFilled) { - isNameFilled = true; - phonePrefix = splitMessages[i].substring(2); - isPhoneFilled = true; - } else if (!isNameFilled && !splitMessages[i].substring(0, 2).equals("p/")) { - namePrefix += splitMessages[i] + " "; - } else { - rest += splitMessages[i] + " "; - } + String namePrefix = splitMessages[0].substring(2) + " "; + String phonePrefix = ""; + String rest = " "; + Boolean isNameFilled = false; + Boolean isPhoneFilled = false; + + for (int i = 1; i < splitMessages.length; i++) { + if (!isNameFilled && splitMessages[i].substring(0, 2).equals("p/") && !isPhoneFilled) { + isNameFilled = true; + phonePrefix = splitMessages[i].substring(2); + isPhoneFilled = true; + } else if (!isNameFilled && !splitMessages[i].substring(0, 2).equals("p/")) { + namePrefix += splitMessages[i] + " "; + } else { + rest += splitMessages[i] + " "; } + } + + ArgumentMultimap argMultimap = + ArgumentTokenizer.tokenize(rest, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, + PREFIX_DATEOFBIRTH, PREFIX_SEX, PREFIX_APPOINTMENT); - ArgumentMultimap argMultimap = - ArgumentTokenizer.tokenize(rest, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, - PREFIX_DATEOFBIRTH, PREFIX_SEX, PREFIX_APPOINTMENT); + argMultimap.verifyNoDuplicatePrefixesFor(PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, + PREFIX_DATEOFBIRTH, PREFIX_SEX, PREFIX_APPOINTMENT); - argMultimap.verifyNoDuplicatePrefixesFor(PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, - PREFIX_DATEOFBIRTH, PREFIX_SEX, PREFIX_APPOINTMENT); + EditPatientDescriptor editPatientDescriptor = new EditPatientDescriptor(); - EditPatientDescriptor editPatientDescriptor = new EditPatientDescriptor(); + setEditPatientDescriptor(editPatientDescriptor, argMultimap); - setEditPatientDescriptor(editPatientDescriptor, argMultimap); + return new EditCommand(new Name(namePrefix.trim()), new Phone(phonePrefix.trim()), editPatientDescriptor); - return new EditCommand(new Name(namePrefix.trim()), new Phone(phonePrefix.trim()), editPatientDescriptor); - } catch (Exception e) { - throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditCommand.MESSAGE_USAGE)); - } } private EditCommand parseStringWithIndex(String args) throws ParseException {