Skip to content

Commit

Permalink
DeveloperGuide.adoc: add new subsection Feature Contributions (nus-cs…
Browse files Browse the repository at this point in the history
…2103-AY1718S2#49)

Some minor edits based on the helpful suggestions from eugenepeh.
  • Loading branch information
yuhongherald authored Mar 17, 2018
1 parent 13847b7 commit 4b549da
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 57 deletions.
41 changes: 21 additions & 20 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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*
Expand Down Expand Up @@ -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}_

Expand Down
65 changes: 65 additions & 0 deletions docs/team/yuhongherald.adoc
Original file line number Diff line number Diff line change
@@ -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]

13 changes: 0 additions & 13 deletions src/main/java/seedu/address/logic/commands/Command.java
Original file line number Diff line number Diff line change
@@ -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;

/**
Expand Down Expand Up @@ -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.
*
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/seedu/address/logic/commands/CommandWords.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> commands;
/**
* Creates a data structure to maintain used command words.
Expand All @@ -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<String, String> verifiedCommands) {
verifiedCommands.put(command, commands.getOrDefault(command, command));
Expand Down Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/logic/commands/SetCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -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!";
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/seedu/address/logic/parser/ParserUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 9 additions & 7 deletions src/main/java/seedu/address/logic/parser/SetCommandParser.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -9,21 +12,20 @@
* Parses input arguments and creates a new AddCommand object
*/
public class SetCommandParser implements Parser<SetCommand> {
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
* and returns an AddCommand object for execution.
* @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());
}

}
13 changes: 0 additions & 13 deletions src/test/java/seedu/address/logic/commands/SetCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/systemtests/AddressBookSystemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 4b549da

Please sign in to comment.