Skip to content

Commit

Permalink
Merge pull request #164 from modembcc/branch-ug-finals
Browse files Browse the repository at this point in the history
Update UG
  • Loading branch information
modembcc authored Apr 15, 2024
2 parents 591e1ba + 0bdcbb9 commit 0bd17e6
Show file tree
Hide file tree
Showing 40 changed files with 245 additions and 196 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ dependencies {
}

shadowJar {
archiveFileName = 'tp_new.jar'
archiveFileName = '[CS2103T-W08-4][DevPlanPro].jar'
}

run {
Expand Down
206 changes: 152 additions & 54 deletions docs/UserGuide.md

Large diffs are not rendered by default.

Binary file added docs/images/AddProjectCommandResult.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/AddTaskCommandResult.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/FilterCategoryCommandResult.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/SetProjectStatusCommandResult.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/SetTaskStatusCommandResult.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/ShowHelpCommandResult.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/Ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public class AssignPersonCommand extends Command {

public static final String COMMAND_WORD = "assign person";

public static final String MESSAGE_USAGE = COMMAND_WORD + "PERSON_NAME"
+ "/to TASK_NAME"
+ "/in PROJECT_NAME";
public static final String MESSAGE_USAGE = COMMAND_WORD + " PERSON_NAME"
+ " /to TASK_NAME"
+ " /in PROJECT_NAME";

public static final String MESSAGE_PROJECT_NOT_FOUND = "Project %1$s not found: "
+ "Please make sure the project exists.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public class AssignTeamCommand extends Command {

public static final String COMMAND_WORD = "assign team";

public static final String MESSAGE_USAGE = COMMAND_WORD + "PERSON_NAME, PERSON_NAME, PERSON_NAME"
+ "/to PROJECT_NAME";
public static final String MESSAGE_USAGE = COMMAND_WORD + " PERSON_NAME, PERSON_NAME, PERSON_NAME"
+ " /to PROJECT_NAME";

public static final String MESSAGE_PROJECT_NOT_FOUND = "Project %1$s not found: "
+ "Please make sure the project exists.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/
public class EditTaskNameCommand extends RenameCommand {
public static final String MESSAGE_USAGE = RenameCommand.COMMAND_WORD
+ "NEW_TASK_NAME /of TARGET_TASK_NAME"
+ "/in PROJECT_NAME";
+ " NEW_TASK_NAME /of TARGET_TASK_NAME"
+ " /in PROJECT_NAME";

public static final String MESSAGE_SUCCESS = "Task %1$s of project %2$s has been renamed to %3$s";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class SetDeadlineProjectCommand extends SetDeadlineCommand {


public static final String MESSAGE_WRONG_FORMAT_DEADLINE = "The deadline %1s has been entered in the wrong format. "
+ "An example of the correct format is Mar 15 2024";
+ "An example of the correct format is Mar 15 2024.";

private final String deadline;
private final Project project;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ public CommandResult execute(Model model) throws CommandException {
} else if (isIncompleted()) {
realProject.setIncomplete();
resultString = String.format(MESSAGE_SUCCESS, Messages.format(statusProject), "incomplete");
} else {
throw new CommandException(String.format(MESSAGE_WRONG_FORMAT_STATUS));
}

model.setProject(dupProject, realProject);

model.updateFilteredProjectList(PREDICATE_SHOW_ALL_PROJECTS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ public abstract class SetStatusCommand extends Command {

public static final String COMMAND_WORD = "set status";

public static final String MESSAGE_WRONG_FORMAT_STATUS = "The status has been entered in the wrong format.";

private final String status;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ public CommandResult execute(Model model) throws CommandException {
} else if (isIncompleted()) {
statusTask.setIncomplete();
resultString = String.format(MESSAGE_SUCCESS, Messages.format(statusTask), "incomplete");
} else {
throw new CommandException(String.format(MESSAGE_WRONG_FORMAT_STATUS));
}
model.updateCurrentProject(
new NameEqualsPredicate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import seedu.address.logic.commands.AddCommentCommand;
import seedu.address.logic.commands.AddTaskCommand;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.person.Name;
import seedu.address.model.project.Member;
Expand Down Expand Up @@ -31,14 +30,13 @@ public AddCommentCommand parse(String args) throws ParseException {
String comment = args.split(" /from ")[0].trim();
String memberAndProject = args.split(" /from ")[1];
if (comment.length() == 0) {
throw new ParseException("Please enter a comment");
throw new ParseException("Please enter a comment.");
}
String memberName = memberAndProject.split(" /to ")[0];
String projectName = memberAndProject.split(" /to ")[1];
if (memberName.length() == 0 || projectName.length() == 0) {
throw new ParseException(String.format(
MESSAGE_INVALID_COMMAND_FORMAT,
AddTaskCommand.MESSAGE_USAGE));
if (memberName.length() == 0 || projectName.length() == 0
|| !Name.isValidName(projectName) || !Name.isValidName(memberName)) {
throw new ParseException("Names should be alphanumerical and not empty.");
}
Member member = new Member(memberName);
Name name = ParserUtil.parseName(projectName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public AddPersonCommand parse(String args) throws ParseException {
memberName = memberName.trim();
projectName = projectName.trim();
if ((memberName.length() == 0) || (projectName.length() == 0)) {
throw new ParseException("Please enter the member and project fields");
throw new ParseException("Please enter the member and project fields.");
}
Member member = new Member(memberName);
Name name = ParserUtil.parseName(projectName);
Expand All @@ -41,7 +41,7 @@ public AddPersonCommand parse(String args) throws ParseException {
MESSAGE_INVALID_COMMAND_FORMAT,
AddPersonCommand.MESSAGE_USAGE));
} catch (IllegalArgumentException e) {
throw new ParseException("Please enter valid names.");
throw new ParseException("Names should be alphanumerical and not empty.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,14 @@ public AddTaskCommand parse(String args) throws ParseException {
}
String taskName = args.split(" /to")[0];
String projectName = args.split("/to ")[1];
if ((taskName.length() == 0) || (projectName.length() == 0)) {
throw new ParseException("Please enter the task and project fields");
if (!Name.isValidName(projectName) || !Name.isValidName(taskName)) {
throw new ParseException("Names should be alphanumerical and not empty.");
}
ParserUtil.parseName(taskName);
Task task = new Task(taskName);
Name name = ParserUtil.parseName(projectName);
Project project = new Project(name);
return new AddTaskCommand(task, project);
} catch (ParseException e) {
throw e;
} catch (ArrayIndexOutOfBoundsException e) {
throw new ParseException(String.format(
MESSAGE_INVALID_COMMAND_FORMAT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@ public class AssignPersonCommandParser implements Parser<AssignPersonCommand> {
public AssignPersonCommand parse(String args) throws ParseException {
try {
if (!args.contains(" /to ") || !args.contains(" /in ")) {
throw new ParseException("Whoops! When referring to another field like a task,"
+ " always remember to put /to instead of just to."
+ " When referring to a project, use /in instead of just in. ");
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
AssignPersonCommand.MESSAGE_USAGE));
}
String member = args.split(" /to")[0].trim();
String taskAndProject = args.split(" /to")[1].trim();
String taskName = taskAndProject.split("/in ")[0].trim();
String projectName = taskAndProject.split("/in ")[1].trim();
if ((taskName.length() == 0) || (projectName.length() == 0) || (member.length() == 0)) {
throw new ParseException("Please enter the task, project and member fields");
throw new ParseException("Please enter the task, project and member fields.");
}
Project project = new Project(ParserUtil.parseName(projectName));
Task newTask = new Task(taskName);
Expand All @@ -39,7 +38,7 @@ public AssignPersonCommand parse(String args) throws ParseException {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
AssignPersonCommand.MESSAGE_USAGE));
} catch (IllegalArgumentException e) {
throw new ParseException("Please enter valid names.");
throw new ParseException("Names should be alphanumerical and not empty.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ public class AssignTeamCommandParser implements Parser<AssignTeamCommand> {
public AssignTeamCommand parse(String args) throws ParseException {
try {
if (!args.contains(" /to ")) {
throw new ParseException("Whoops! When referring to another field like a project,"
+ " always remember to put /to instead of just to.");
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
AssignTeamCommand.MESSAGE_USAGE));
}
String members = args.split(" /to")[0].trim();
String projectName = args.split(" /to")[1].trim();
List<String> team = Arrays.stream(members.split(","))
.map(String::trim)
.collect(Collectors.toList());
if (team.stream().anyMatch(member -> (member.length() == 0 || !Name.isValidName(member)))) {
throw new ParseException("Please enter valid names");
throw new ParseException("Names should be alphanumerical and not empty.");
}
if ((team.size() == 0) || (projectName.length() == 0)) {
throw new ParseException("Please enter the project and team fields");
throw new ParseException("Please enter the project and team fields.");
}
Project project = new Project(ParserUtil.parseName(projectName));
return new AssignTeamCommand(team, project);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,9 @@ public DeletePersonCommand parse(String args) throws ParseException {
String memberName = args.split(" /in")[0];
String projectName = args.split("/in ")[1];

if ((memberName.length() == 0) || (projectName.length() == 0)) {
throw new ParseException("Please enter the member and the project field");
}
return new DeletePersonCommand(new Member(memberName), new Project(new Name(projectName)));
} catch (IllegalArgumentException e) {
throw new ParseException("Please enter valid names.");
} catch (Exception e) {
throw new ParseException(String.format(
MESSAGE_INVALID_COMMAND_FORMAT,
DeletePersonCommand.MESSAGE_USAGE));
throw new ParseException("Names should be alphanumerical and not empty.");
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import seedu.address.logic.commands.DeleteProjectCommand;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.person.Name;

/**
* Parses input arguments and creates a new DeleteProjectCommand object
Expand All @@ -16,19 +15,11 @@ public class DeleteProjectCommandParser implements Parser<DeleteProjectCommand>
* @throws ParseException if the user input does not conform the expected format
*/
public DeleteProjectCommand parse(String args) throws ParseException {
try {
args = args.trim();
if (args.length() == 0) {
throw new ParseException("Please enter the project field.");
}

System.out.println(args);
return new DeleteProjectCommand(args);
} catch (Exception e) {
throw new ParseException(String.format(
MESSAGE_INVALID_COMMAND_FORMAT,
DeleteProjectCommand.MESSAGE_USAGE));
args = args.trim();
if (args.length() == 0 || !Name.isValidName(args)) {
throw new ParseException("Project name should be alphanumerical and not empty.");
}
return new DeleteProjectCommand(args);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ public DeleteTaskCommand parse(String args) throws ParseException {
}
String taskName = args.split(" /in")[0];
String projectName = args.split("/in ")[1];
Task task = new Task(taskName);
if ((taskName.length() == 0) || (projectName.length() == 0)) {
throw new ParseException("Please enter the project and the task field");
if ((taskName.length() == 0) || (projectName.length() == 0
|| (!Name.isValidName(projectName) || (!Name.isValidName(taskName))))) {
throw new ParseException("Names should be alphanumerical and not empty.");
}
Task task = new Task(taskName);
Name name = ParserUtil.parseName(projectName);
Project project = new Project(name);
return new DeleteTaskCommand(task, project);
Expand Down
17 changes: 7 additions & 10 deletions src/main/java/seedu/address/logic/parser/RenameCommandParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@ public class RenameCommandParser implements Parser<RenameCommand> {
public RenameCommand parse(String args) throws ParseException {
try {
if (!args.contains(" /of ")) {
throw new ParseException("Whoops! When referring to another field like a project or task,"
+ " always remember to put /of instead of just of.");
}
String newName = args.split(" /of ")[0];
String possibleTargetName = args.split(" /of ")[1];
if ((newName.length() == 0) || (possibleTargetName.length() == 0)) {
throw new ParseException("Please enter both the target and new project name or both target task and "
+ "the project it belongs to if you want to rename a specific task");
throw new ParseException(String.format(
MESSAGE_INVALID_COMMAND_FORMAT,
EditTaskNameCommand.MESSAGE_USAGE));
}
String newName = args.split(" /of ")[0].trim();
String possibleTargetName = args.split(" /of ")[1].trim();
Name changedTo = ParserUtil.parseName(newName);
if (args.contains(" /in ")) {
return parseEditTaskNameCommand(possibleTargetName, changedTo);
Expand All @@ -55,8 +52,8 @@ private EditTaskNameCommand parseEditTaskNameCommand(String possibleTargetName,
Name changedTo) throws ParseException {
String taskName = possibleTargetName.split(" /in ")[0];
String projectName = possibleTargetName.split(" /in ")[1];
if ((taskName.length() == 0) || (projectName.length() == 0)) {
throw new ParseException("Please enter both the target task name and the project it belongs to");
if (!Name.isValidName(taskName)) {
throw new ParseException("Names should be alphanumerical and not empty.");
}
Name targetProjectName = ParserUtil.parseName(projectName);
Project targetProject = new Project(targetProjectName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import seedu.address.logic.commands.SetDeadlineProjectCommand;
import seedu.address.logic.commands.SetDeadlineTaskCommand;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.person.Name;
import seedu.address.model.project.Project;
import seedu.address.model.project.Task;

Expand Down Expand Up @@ -39,9 +40,6 @@ public SetDeadlineCommand parse(String args) throws ParseException {
if (!args.contains(" /in ")) {
//SetDeadlineProjectCommand
String projectName = args.split("/to ")[1];
if ((projectName.length() == 0)) {
throw new ParseException("Please enter the project field");
}
Project project = new Project(ParserUtil.parseName(projectName));
return new SetDeadlineProjectCommand(deadline, project);
} else {
Expand All @@ -61,8 +59,8 @@ private SetDeadlineTaskCommand parseSetDeadlineTaskCommand(String args) throws P
String taskAndProject = args.split(" /to")[1].trim();
String taskName = taskAndProject.split("/in ")[0].trim();
String projectName = taskAndProject.split("/in ")[1];
if ((projectName.length() == 0) || (taskName.length() == 0)) {
throw new ParseException("Please enter the project and task fields");
if (!Name.isValidName(taskName)) {
throw new ParseException("Names should be alphanumerical and not empty.");
}
Project project = new Project(ParserUtil.parseName(projectName));
Task newTask = new Task(taskName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,18 @@ public SetProjectCategoryCommand parse(String args) throws ParseException {
}
String category = args.split(" /to")[0].trim();
String projectName = args.split("/to ")[1];
if ((projectName.length() == 0) || category.length() == 0) {
throw new ParseException("Please enter the project field");
if (category.length() == 0) {
throw new ParseException("Please enter the category.");
}
Project project = new Project(ParserUtil.parseName(projectName));
return new SetProjectCategoryCommand(category, project);

} catch (Exception e) {
} catch (IllegalArgumentException e) {
throw new ParseException("Names should be alphanumerical and not empty.");
} catch (ArrayIndexOutOfBoundsException e) {
throw new ParseException(String.format(
MESSAGE_INVALID_COMMAND_FORMAT,
SetProjectCategoryCommand.MESSAGE_USAGE));
MESSAGE_INVALID_COMMAND_FORMAT,
SetProjectCategoryCommand.MESSAGE_USAGE));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import seedu.address.logic.commands.SetStatusCommand;
import seedu.address.logic.commands.SetTaskStatusCommand;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.person.Name;
import seedu.address.model.project.Project;
import seedu.address.model.project.Task;

Expand Down Expand Up @@ -33,9 +34,6 @@ public SetStatusCommand parse(String args) throws ParseException {
}
String taskAndProject = args.split(" /of")[1].trim();
if (!args.contains(" /in ")) {
if ((taskAndProject.length() == 0) || (status.length() == 0)) {
throw new ParseException("Please enter the status and project fields");
}
Project project = new Project(ParserUtil.parseName(taskAndProject));
return new SetProjectStatusCommand(status, project);
}
Expand All @@ -53,13 +51,11 @@ public SetStatusCommand parse(String args) throws ParseException {
}

private SetTaskStatusCommand parseSetTaskStatusCommand(String taskAndProject, String status) throws ParseException {
if ((taskAndProject.length() == 0) || (status.length() == 0)) {
throw new ParseException("Please enter the status, project and task fields");
}
String taskName = taskAndProject.split("/in ")[0].trim();
String projectName = taskAndProject.split("/in ")[1];
if ((projectName.length() == 0) || (taskName.length() == 0) || (status.length() == 0)) {
throw new ParseException("Please enter the status, project and task fields");
if ((projectName.length() == 0) || (taskName.length() == 0)
|| (!Name.isValidName(projectName)) || (!Name.isValidName(taskName))) {
throw new ParseException("Names should be alphanumerical and not empty.");
}
Project project = new Project(ParserUtil.parseName(projectName));
Task newTask = new Task(taskName);
Expand Down
Loading

0 comments on commit 0bd17e6

Please sign in to comment.