Skip to content
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

Week 3 Address Book Pull Request #28

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ToonDragon
Copy link

Hi Ewald

Here is the pull request for your review.

@ewaldhew

Static parameters for new function to edit phone number added

Test file used for tutorial demonstration removed
Changed "edit phone" command to "edit_phone" for easier usage

Added help text into the display help function

Modified the expected output file to reflect new changes
Entering the "edit_phone" command with the necessary parameters will now be accepted.
Entering invalid indexes like very large numbers or non numbers will no longer be accepted.

Persisting Issues:
Checking for 2nd parameter (the phone number to be changed to) has not been implemented yet.
Actual changing function has not been implemented yet.

Test files still work since no test for this scenerio has been added.
Function will now change the phone number of a selected index to a newly specified phone number.
Checker will prevent any non numbers from being entered into the phone number field.

Test file still works because the new function auto test has yet to be added

Outstanding tasks:
Update test file to include testing for the Edit Phone Number function
Added test for editting of phone number.

Test can be run without problems.
Copy link

@ewaldhew ewaldhew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work, for remembering to update tests and help messages also!

/**
* Edits the phone number of a person identified using last displayed index.
*
* @param commandArgs full command args string from the user

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be more descriptive, maybe state what the command args should contain?

final String phoneNumberToChange = splitUserArgs[1].trim();
if (!phoneNumberToChange.matches("[0-9]+")) {
return getMessageForInvalidCommandInput(COMMAND_EDIT_PHONE_WORD, getUsageInfoForEditPhoneCommand());
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of checks above here which could have been pulled out into a function that returns boolean, e.g. do if(!isEditPhoneArgsValid(commandArgs) return getMessage..., refer to the other commands. This has the advantage that you can change the behaviour when receiving invalid input to something else more easily.

@ewaldhew
Copy link

@DarrenDragonLee close PR after reading

@nus-se-pr-bot
Copy link

Hi @DarrenDragonLee, your pull request title is invalid.

For PR sent to satisfy a learning outcome, the PR name should be in the format of [Learning Outcome ID][Team ID] Your Name, where [Learning Outcome ID] has no dashes or spaces (e.g. [W3.1a]) and [Team ID] has one dash only and no spaces (e.g. [W14-2] means Wednesday 2pm (14 hrs), Team 2).
E.g. If you are in tutorial W09 (i.e. Wednesday 9am), team 1, and is submitting a PR for LO W2.2b, the PR title would be [W2.2b][W09-1] James Yong. Note that your tutorial IDs are different from those shown in CORS/IVLE.

For team PR, the PR name should be in the format of [Team ID] Product Name (e.g. [T09-2] Contact List Pro).

Please follow the above format strictly and edit your title for reprocessing.

Note: this comment is posted by a bot. If you believe this is done in error, please create an issue at nus-se-pr-bot and add a link to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants