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

Add edit task command into the user guide. #61

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,8 @@ shadowJar {
archiveFileName = 'TeamTracker.jar'
}

run {
enableAssertions = true
}

defaultTasks 'clean', 'test'
27 changes: 26 additions & 1 deletion docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,37 @@ Examples:

### Deleting a task: `deletetask`

Deletes the specified task from the task list.

Format: `deletetask TASK_INDEX`

* Deletes the task at the specified `TASK_INDEX`.
* The index refers to the index number shown in the displayed task list.
* The index **must be a positive integer** 1, 2, 3, …​

Examples:
* `listtask` followed by `deletetask 1` deletes the 1st task in the task list.
* `findtask today` followed by `deletetask 2` deletes the 2nd task in the results of the `findtask` command.

### Editing a task: `edittask`

Edits an existing task in the task listx.

Format: `edittask TASK_INDEX [n/TASK_NAME] [d/TASK_DESCRIPTION] [p/TASK_PRIORITY] [by/TASK_DEADLINE]​`

* Edits the task at the specified `TASK_INDEX`. The index refers to the index number shown in the displayed task list. The index **must be a positive integer** 1, 2, 3, …​
* At least one of the optional fields must be provided.
* Existing values will be updated to the input values.

Examples:
* `deletetask 1`
* `edittask 1 p/high`
* `edittask 2 d/new description by/04-04-2024 10:33`
* `edittask 3 n/new task d/new description p/low by/04-04-2024 10:33`

### Listing the tasks: `listtask`

Shows a list of all tasks in the task list.

Format: `listtask`

Examples:
Expand Down Expand Up @@ -273,6 +297,7 @@ Action | Format, Examples
**Help** | `help`
**Add Task** | `addtask n/NAME d/DESCRIPTION p/PRIORITY [by/DEADLINE]`
**Delete Task** | `deletetask TASK_INDEX`
**Edit Task** | `edittask TASK_INDEX [n/TASK_NAME] [d/TASK_DESCRIPTION] [p/TASK_PRIORITY] [by/TASK_DEADLINE]​`
**Assign Task** | `assign TASK_INDEX to/PERSON_INDEX​`
**Mark Task** | `marktask TASK_INDEX​`
**Unmark Task** | `unmarktask TASK_INDEX​`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class DeleteTaskCommand extends Command {
public static final String COMMAND_WORD = "deletetask";
public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Deletes the task identified by the index number used in the displayed task list.\n"
+ "Parameters: INDEX (must be a positive integer)\n"
+ "Parameters: TASK_INDEX (must be a positive integer)\n"
+ "Example: " + COMMAND_WORD + " 1";
public static final String MESSAGE_SUCCESS = "Deleted Task: %1$s";
public static final String MESSAGE_INDEX_TOO_LARGE = "The index is not valid, use \"listtask\" to "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the details of the task identified "
+ "by the index number used in the displayed task list. "
+ "Existing values will be overwritten by the input values.\n"
+ "Parameters: INDEX (must be a positive integer) "
+ "Parameters: TASK_INDEX (must be a positive integer) "
+ "[" + PREFIX_NAME + "TASK_NAME] "
+ "[" + PREFIX_TASK_DESCRIPTION + "TASK_DESCRIPTION] "
+ "[" + PREFIX_TASK_PRIORITY + "TASK_PRIORITY] "
Expand All @@ -51,8 +51,8 @@
private final EditTaskDescriptor editTaskDescriptor;

/**
* @param index of the task in the task list to edit
* @param editTaskDescriptor details to edit the task with
* @param index of the task in the task list to edit.
* @param editTaskDescriptor details to edit the task with.
*/
public EditTaskCommand(Index index, EditTaskDescriptor editTaskDescriptor) {
requireNonNull(index);
Expand Down Expand Up @@ -125,8 +125,7 @@

/**
* Stores the details to edit the task with. Each non-empty field value will
* replace the
* corresponding field value of the task.
* replace the corresponding field value of the task.
*/
public static class EditTaskDescriptor {
private TaskName taskName;
Expand Down Expand Up @@ -189,12 +188,12 @@
@Override
public boolean equals(Object other) {
if (other == this) {
return true;

Check warning on line 191 in src/main/java/seedu/address/logic/commands/EditTaskCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/EditTaskCommand.java#L191

Added line #L191 was not covered by tests
}

// instanceof handles nulls
if (!(other instanceof EditTaskDescriptor)) {
return false;

Check warning on line 196 in src/main/java/seedu/address/logic/commands/EditTaskCommand.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/logic/commands/EditTaskCommand.java#L196

Added line #L196 was not covered by tests
}

EditTaskDescriptor otherEditTaskDescriptor = (EditTaskDescriptor) other;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class MarkTaskCommand extends Command {
public static final String COMMAND_WORD = "marktask";
public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Marks a task from the task list as done. \n"
+ "Parameter: INDEX (Must be a positive integer) \n"
+ "Parameter: TASK_INDEX (Must be a positive integer) \n"
+ "Example: " + COMMAND_WORD + " 1";
public static final String MESSAGE_MARK_TASK_SUCCESS = "Task has been mark as done: %1$s";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class UnmarkTaskCommand extends Command {
public static final String COMMAND_WORD = "unmarktask";
public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Marks a task from the task list as undone. \n"
+ "Parameter: INDEX (Must be a positive integer) \n"
+ "Parameter: TASK_INDEX (Must be a positive integer) \n"
+ "Example: " + COMMAND_WORD + " 1";
public static final String MESSAGE_UNMARK_TASK_SUCCESS = "Task has been mark as undone: %1$s";

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/ModelManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public TaskList getTaskList() {
}

/**
* Returns an unmodifiable view of the list of {@code Task}.
* Returns an modifiable view of the list of {@code Task}.
*/
@Override
public ObservableList<Task> getFilteredTaskList() {
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/seedu/address/model/TaskList.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@
}

/**
* Replaces the given task {@code target} in the list with
* Replaces the given task {@code target} in the list with {@code editedTask}.
* {@code target} must exist in the task list.
* {@code editedTask}.
* The task of {@code editedTask} must not be the same as another
* existing task in the task list.
*/
Expand Down Expand Up @@ -90,7 +89,7 @@
return o1.getStatus().getTaskStatus() ? 1 : -1;
}

// Sort by Priority
// Sort by priority
if (o2.getPriority().getValue() - o1.getPriority().getValue() != 0) {
return o2.getPriority().getValue() - o1.getPriority().getValue();
}
Expand All @@ -104,9 +103,9 @@
if (o1.getDeadline() != null) {
return -1;
} else if (o2.getDeadline() != null) {
return 1;

Check warning on line 106 in src/main/java/seedu/address/model/TaskList.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/model/TaskList.java#L106

Added line #L106 was not covered by tests
}
return 0;

Check warning on line 108 in src/main/java/seedu/address/model/TaskList.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/seedu/address/model/TaskList.java#L108

Added line #L108 was not covered by tests
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ public static void assertCommandFailure(Command command, Model actualModel, Stri

/**
* Updates {@code model}'s filtered list to show only the person at the given
* {@code targetIndex} in the
* {@code model}'s address book.
* {@code targetIndex} in the {@code model}'s address book.
*/
public static void showPersonAtIndex(Model model, Index targetIndex) {
assertTrue(targetIndex.getZeroBased() < model.getFilteredPersonList().size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public EditTaskDescriptorBuilder(EditTaskDescriptor descriptor) {

/**
* Returns an {@code EditTaskDescriptor} with fields containing {@code task}'s
* details
* details.
*/
public EditTaskDescriptorBuilder(Task task) {
descriptor = new EditTaskDescriptor();
Expand Down
Loading