diff --git a/docs/DeveloperGuide.adoc b/docs/DeveloperGuide.adoc index 3ebbc04ceb48..c4d62cb5d91b 100644 --- a/docs/DeveloperGuide.adoc +++ b/docs/DeveloperGuide.adoc @@ -801,6 +801,19 @@ See this https://github.com/se-edu/addressbook-level4/pull/599[PR] for the step- *Value proposition*: A convenient App for car servicing managers to organize servicing jobs and assign specific employees. +*Feature contributions*: + +* Importing job entries from an excel file (Major) ++ +[none] +** User can specify the file path to an excel file containing the job entries in columns, and header fields to indicate the +** field contents for each row. User then reviews the changes and generates a feedback document. + +* Setting custom command keywords (Minor) ++ +[none] +** User can set a custom keyword that is not used on top of the original command word. + [appendix] == User Stories @@ -911,25 +924,6 @@ Use case ends. + Use case resumes at step 1. -[discrete] -=== Use case: Navigate using the keyboard - -*MSS* - -1. User presses a key to change selection. -2. CarviciM changes selection. -+ -Use case ends. - -*Extensions* - -[none] -* 1a. CarviciM is not focussed. -+ -[none] -** 1a1. User presses global refocus hotkey. -Use case resumes at step 1. - [discrete] === Use case: Add employee @@ -1179,6 +1173,13 @@ Use case ends. + Use case ends. +[none] +* 1c. The new command word is a default command word for another command. +[none] +** 1c1. CarviciM shows an error message. ++ +Use case ends. + === Use case: Set theme of application *MSS* @@ -1219,7 +1220,7 @@ _{More to be added}_ . Should respond to user command within 2 seconds. . Should be usable by a novice who has never used an electronic job management app before. . User interface should be intuitive enough for users who are not IT-savvy. -. View should fit the screen of any computer screen size. +. View should fit the screen of any computer with minimum screen size of 640 by 480 pixels. _{More to be added}_ diff --git a/docs/team/yuhongherald.adoc b/docs/team/yuhongherald.adoc new file mode 100644 index 000000000000..da159ff8cf8e --- /dev/null +++ b/docs/team/yuhongherald.adoc @@ -0,0 +1,65 @@ += Yu Hong Herald - Project Portfolio +:imagesDir: ../images +:stylesDir: ../stylesheets + +== PROJECT: Car Servicing Manager + +--- + +== Overview + +Coming in v2.0 + +== Summary of contributions + +* *Major enhancement*: added *the ability to import job entries from an excel file* +** What it does: allows the user to undo all previous commands one at a time. Preceding undo commands can be reversed by using the redo command. +** Justification: This feature improves the product significantly because a user can make mistakes in commands and the app should provide a convenient way to rectify them. +** Highlights: This enhancement affects existing commands and commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing commands. +** Credits: _{mention here if you reused any code/ideas from elsewhere or if a third-party library is heavily used in the feature so that a reader can make a more accurate judgement of how much effort went into the feature}_ + +* *Minor enhancement*: added a set command that allows the user to use a custom keyword in place of the default keyword. + +* *Code contributed*: [https://github.com[Functional code]] [https://github.com[Test code]] _{give links to collated code files}_ + +* *Other contributions*: + +** Project management: +*** Managed releases `v1.3` - `v1.5rc` (3 releases) on GitHub +** Enhancements to existing features: +*** Updated the GUI color scheme (Pull requests https://github.com[#33], https://github.com[#34]) +*** Wrote additional tests for existing features to increase coverage from 88% to 92% (Pull requests https://github.com[#36], https://github.com[#38]) +** Documentation: +*** Did cosmetic tweaks to existing contents of the User Guide: https://github.com[#14] +** Community: +*** PRs reviewed (with non-trivial review comments): https://github.com[#12], https://github.com[#32], https://github.com[#19], https://github.com[#42] +*** Contributed to forum discussions (examples: https://github.com[1], https://github.com[2], https://github.com[3], https://github.com[4]) +*** Reported bugs and suggestions for other teams in the class (examples: https://github.com[1], https://github.com[2], https://github.com[3]) +*** Some parts of the history feature I added was adopted by several other class mates (https://github.com[1], https://github.com[2]) +** Tools: +*** Integrated a third party library (Natty) to the project (https://github.com[#42]) +*** Integrated a new Github plugin (CircleCI) to the team repo + +_{you can add/remove categories in the list above}_ + +== Contributions to the User Guide + + +|=== +|_Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users._ +|=== + +include::../UserGuide.adoc[tag=undoredo] + +include::../UserGuide.adoc[tag=dataencryption] + +== Contributions to the Developer Guide + +|=== +|_Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project._ +|=== + +include::../DeveloperGuide.adoc[tag=undoredo] + +include::../DeveloperGuide.adoc[tag=dataencryption] + diff --git a/src/main/java/seedu/address/logic/commands/Command.java b/src/main/java/seedu/address/logic/commands/Command.java index f350e8924fd5..b3371288a6fe 100644 --- a/src/main/java/seedu/address/logic/commands/Command.java +++ b/src/main/java/seedu/address/logic/commands/Command.java @@ -1,12 +1,9 @@ package seedu.address.logic.commands; -import static java.util.Objects.requireNonNull; - import seedu.address.commons.core.Messages; import seedu.address.logic.CommandHistory; import seedu.address.logic.UndoRedoStack; import seedu.address.logic.commands.exceptions.CommandException; -import seedu.address.logic.commands.exceptions.CommandWordException; import seedu.address.model.Model; /** @@ -48,16 +45,6 @@ public static String getMessageForPersonListShownSummary(int displaySize) { return String.format(Messages.MESSAGE_PERSONS_LISTED_OVERVIEW, displaySize); } - /** - * @param key used to reference Command Word - * @return Command word used - * @throws CommandWordException command word is not valid - */ - public String getCommandWord(String key) throws CommandWordException { - requireNonNull(model); - return model.getCommandWords().getCommandWord(key); - } - /** * Executes the command and returns the result message. * diff --git a/src/main/java/seedu/address/logic/commands/CommandWords.java b/src/main/java/seedu/address/logic/commands/CommandWords.java index 85417c54f874..cc91649e6899 100644 --- a/src/main/java/seedu/address/logic/commands/CommandWords.java +++ b/src/main/java/seedu/address/logic/commands/CommandWords.java @@ -16,6 +16,7 @@ public class CommandWords implements Serializable { public static final String MESSAGE_INACTIVE = "%s is not an active command."; public static final String MESSAGE_DUPLICATE = "%s is already used."; + public static final String MESSAGE_NO_CHANGE = "Old and new command word is the same."; public final HashMap commands; /** * Creates a data structure to maintain used command words. @@ -34,7 +35,9 @@ public CommandWords(CommandWords commandWords) { } /** - * Moves (@code command from (@code COMMANDS) to (@code verifiedCommands). Creates a new entry if missing. + * Copies key and value of (@code command) from (@code commands) + * to (@code verifiedCommands). Creates a new entry with default + * key = value if missing. */ private void moveVerifiedWord(String command, HashMap verifiedCommands) { verifiedCommands.put(command, commands.getOrDefault(command, command)); @@ -94,7 +97,7 @@ public String getCommandKey(String value) throws CommandWordException { public void setCommandWord(String currentWord, String newWord) throws CommandWordException { requireNonNull(currentWord, newWord); if (currentWord.equals(newWord)) { - return; + throw new CommandWordException(MESSAGE_NO_CHANGE); } if (commands.containsValue(newWord)) { throw new CommandWordException(String.format(MESSAGE_DUPLICATE, newWord)); diff --git a/src/main/java/seedu/address/logic/commands/SetCommand.java b/src/main/java/seedu/address/logic/commands/SetCommand.java index ac3359374b13..615b85a9a927 100644 --- a/src/main/java/seedu/address/logic/commands/SetCommand.java +++ b/src/main/java/seedu/address/logic/commands/SetCommand.java @@ -15,7 +15,7 @@ public class SetCommand extends UndoableCommand { public static final String MESSAGE_USAGE = COMMAND_WORD + ": Sets a command word to user preference. " + "Parameters: CURRENT_COMMAND_WORD NEW_COMMAND_WORD" - + "Example: " + "%s" + " " + + "Example: " + "set" + " " + "OLD_COMMAND" + "NEW_COMMAND"; public static final String MESSAGE_SUCCESS = "%s has been replaced with %s!"; diff --git a/src/main/java/seedu/address/logic/parser/ParserUtil.java b/src/main/java/seedu/address/logic/parser/ParserUtil.java index 5d6d4ae3f7b1..0260010aa2ab 100644 --- a/src/main/java/seedu/address/logic/parser/ParserUtil.java +++ b/src/main/java/seedu/address/logic/parser/ParserUtil.java @@ -29,6 +29,25 @@ public class ParserUtil { public static final String MESSAGE_INVALID_INDEX = "Index is not a non-zero unsigned integer."; public static final String MESSAGE_INSUFFICIENT_PARTS = "Number of parts must be more than 1."; + public static final String MESSAGE_INSUFFICIENT_WORDS = "Command word to be changed and new command word must " + + "be provided, separated by a space."; + public static final String WHITESPACE = "\\s+"; + + /** + * Parses {@code multipleWordString} into an {@code String[]} containing command words and returns it. + * Leading and trailing whitespaces will be trimmed. + * @param multipleWordString + * @return + * @throws IllegalValueException + */ + public static String[] parseWords(String multipleWordString) throws IllegalValueException { + String[] commandWords = multipleWordString.trim().split(WHITESPACE); + if (commandWords.length != 2) { + throw new IllegalValueException(MESSAGE_INSUFFICIENT_WORDS); + } + return commandWords; + + } /** * Parses {@code oneBasedIndex} into an {@code Index} and returns it. Leading and trailing whitespaces will be diff --git a/src/main/java/seedu/address/logic/parser/SetCommandParser.java b/src/main/java/seedu/address/logic/parser/SetCommandParser.java index 92d8294ebf74..c757ae4d4f08 100644 --- a/src/main/java/seedu/address/logic/parser/SetCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/SetCommandParser.java @@ -1,5 +1,8 @@ package seedu.address.logic.parser; +import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT; +import static seedu.address.logic.parser.ParserUtil.parseWords; + import seedu.address.commons.exceptions.IllegalValueException; import seedu.address.logic.commands.SetCommand; import seedu.address.logic.parser.exceptions.ParseException; @@ -9,7 +12,7 @@ * Parses input arguments and creates a new AddCommand object */ public class SetCommandParser implements Parser { - public static final String MESSAGE_COMMANDS_INVALID_NUMBER = "%s command requires 2 command words."; + /** * Parses the given {@code String} of arg * uments in the context of the AddCommand @@ -17,13 +20,12 @@ public class SetCommandParser implements Parser { * @throws ParseException if the user input does not conform the expected format */ public SetCommand parse(String args) throws ParseException { - String[] commandWords = args.split("\\s+"); - if (commandWords.length != 3) { - IllegalValueException ive = new IllegalValueException( - String.format(SetCommand.MESSAGE_USAGE, commandWords[0])); - throw new ParseException(ive.getMessage(), ive); + try { + String[] commandWords = parseWords(args); + return new SetCommand(commandWords[0], commandWords[1]); + } catch (IllegalValueException ive) { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, SetCommand.MESSAGE_USAGE)); } - return new SetCommand(commandWords[1].trim(), commandWords[2].trim()); } } diff --git a/src/test/java/seedu/address/logic/commands/SetCommandTest.java b/src/test/java/seedu/address/logic/commands/SetCommandTest.java index c8d38e8fc6f1..bd86ee1db8c7 100644 --- a/src/test/java/seedu/address/logic/commands/SetCommandTest.java +++ b/src/test/java/seedu/address/logic/commands/SetCommandTest.java @@ -65,19 +65,6 @@ public void execute_changeCommand_failureUnused() throws CommandWordException { assertCommandFailure(newCommand, actualModel, newCommand.getMessageUnused()); } - @Test - public void execute_changeCommand_shortCircuit() throws CommandWordException { - Model actualModel = new ModelManager(getTypicalAddressBook(), new UserPrefs()); - Model expectedModel = new ModelManager(getTypicalAddressBook(), new UserPrefs()); - String currentWord = AddCommand.COMMAND_WORD; - String newWord = currentWord; - - setCommandWord(expectedModel, currentWord, newWord); - SetCommand newCommand = prepareCommand(actualModel, currentWord, newWord); - assertCommandSuccess(newCommand, actualModel, newCommand.getMessageSuccess(), expectedModel); - } - - private void setCommandWord(Model expectedModel, String currentWord, String newWord) throws CommandWordException { expectedModel.getCommandWords().setCommandWord(currentWord, newWord); } diff --git a/src/test/java/systemtests/AddressBookSystemTest.java b/src/test/java/systemtests/AddressBookSystemTest.java index c8830cc27109..1acd33866abc 100644 --- a/src/test/java/systemtests/AddressBookSystemTest.java +++ b/src/test/java/systemtests/AddressBookSystemTest.java @@ -189,7 +189,7 @@ protected void assertApplicationDisplaysExpected(String expectedCommandInput, St * and the employee list panel displays the persons in the model correctly. */ protected void assertApplicationDisplaysExpectedError(String expectedCommandInput, String expectedResultMessage, - Model expectedModel) { + Model expectedModel) { assertEquals(expectedCommandInput, getCommandBox().getInput()); assertEquals(getModel().appendCommandKeyToMessage(expectedResultMessage), getResultDisplay().getText()); assertEquals(expectedModel, getModel());