-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New UI, refactoring and small fixes #86
Conversation
Other changes: make remark optional in AddCommandParser
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, mostly need to change command names and clarify a bit more on TAB_ID. Would be good if there's another reviewer too.
@@ -8,6 +9,8 @@ | |||
*/ | |||
public abstract class Command { | |||
|
|||
public static final Index TAB_ID = Index.fromOneBased(3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can have an enum for TAB_ID instead to make it more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, can you explain what is the TAB_ID used for in the Command class actually? Is it only relevant in the CommandResult class?
@@ -17,21 +19,25 @@ | |||
/** The application should exit. */ | |||
private final boolean exit; | |||
|
|||
/** Switch to the tab indicated by tabId */ | |||
private final Index tabId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it be confusing to have TAB_ID in Command.java and tabId in CommandResult.java? Maybe more descriptive name like tabIdToSwitchTo can help.
import seedu.address.logic.commands.exceptions.CommandException; | ||
import seedu.address.model.Model; | ||
import seedu.address.model.person.Person; | ||
|
||
/** | ||
* Adds a person to the address book. | ||
*/ | ||
public class AddCommand extends Command { | ||
public class AddPatientCommand extends Command { | ||
|
||
public static final String COMMAND_WORD = "add"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the command word be 'add' or 'add patient'? Since we've changed the AddCommand to AddPatientCommand, and we need to consider adding appointments too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed! I think it will be addpatient
based on our user guide.
@@ -41,7 +43,7 @@ | |||
/** | |||
* Creates an AddCommand to add the specified {@code Person} | |||
*/ | |||
public AddCommand(Person person) { | |||
public AddPatientCommand(Person person) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should rename 'Person' to 'Patient' (but I think this is model people's job)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, we'll do that in the next PR!
@@ -13,11 +16,10 @@ | |||
public static final String COMMAND_WORD = "clear"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since AddCommand was changed to AddPatientCommand, maybe ClearCommand should be changed to be more descriptive also? i.e. change to ClearAllPatientsCommand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed!
import seedu.address.model.person.Name; | ||
import seedu.address.model.person.Person; | ||
import seedu.address.model.person.Phone; | ||
import seedu.address.model.person.Remark; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't add a comment at the required line, but maybe we can rename this command to EditPatientCommand instead to align with AddPatientCommand? Also because we are probably adding capabilities or editing appointments right, so will need to clarify what we're editing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will also need to remember to edit the MESSAGE_USAGE to reflect patient parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import seedu.address.commons.core.Messages; | ||
import seedu.address.logic.commands.Command; | ||
import seedu.address.logic.commands.CommandResult; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise, should we rename to FindPatientCommand?
|
||
import static java.util.Objects.requireNonNull; | ||
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS; | ||
|
||
import seedu.address.commons.core.index.Index; | ||
import seedu.address.logic.commands.Command; | ||
import seedu.address.logic.commands.CommandResult; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise, should we change this to ListPatientsCommand? I'm not very sure because then now we'll have the 'Patient' in every command which is a lot more verbose, but it also makes the command clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so, because we will have various ListAppointmentsCommands, like listing all appointment of a specific patient!
ArgumentMultimap argMultimap = | ||
ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, PREFIX_TAG, | ||
PREFIX_REMARK); | ||
|
||
if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_REMARK) | ||
if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_EMAIL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is PREFIX_REMARK removed?
|
||
import seedu.address.commons.core.index.Index; | ||
import seedu.address.logic.commands.Command; | ||
import seedu.address.logic.commands.CommandResult; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should have RemarkCommand for both patient and appointment? so we split into RemarkPatientCommand and RemarkAppointmentCommand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appointment class already has a String description, is that good enough?
@@ -13,7 +14,7 @@ | |||
|
|||
@Override | |||
public CommandResult execute(Model model) { | |||
return new CommandResult(MESSAGE_EXIT_ACKNOWLEDGEMENT, false, true); | |||
return new CommandResult(MESSAGE_EXIT_ACKNOWLEDGEMENT, false, true, TAB_ID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TAB_ID needs to be declared as a public static final
constant above right?
UI Changes:
Logic component changes:
Small fixes:
Note: Added an "dummy" appointment class (for testing the rest of the app) - to be removed.