Skip to content

Commit

Permalink
Merge branch 'Edit-UI' into Allocate-students-to-team
Browse files Browse the repository at this point in the history
Merge
  • Loading branch information
qinxutan committed Mar 24, 2024
2 parents f783351 + 5b7d7a5 commit 37331ff
Show file tree
Hide file tree
Showing 64 changed files with 809 additions and 240 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ dependencies {
}

shadowJar {
archiveFileName = 'addressbook.jar'
archiveFileName = 'tahelper.jar'
}

defaultTasks 'clean', 'test'
1 change: 1 addition & 0 deletions docs/AboutUs.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

---
layout: default.md
title: "About Us"
Expand Down
23 changes: 16 additions & 7 deletions src/main/java/seedu/address/logic/commands/AddClassCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

import static java.util.Objects.requireNonNull;
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DESCRIPTION;
import static seedu.address.logic.parser.CliSyntax.PREFIX_MODULECODE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TUTORIALCLASS;

import java.util.Optional;

import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;
import seedu.address.model.module.ModuleCode;
Expand All @@ -18,24 +21,29 @@ public class AddClassCommand extends Command {
public static final String MESSAGE_DUPLICATE_CLASS = "%1$s %2$s already added!";
public static final String COMMAND_WORD = "/add_class";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a class with the module code specified\n"
+ "Parameters:" + PREFIX_MODULECODE + "MODULE_CODE (must be a String) "
+ PREFIX_TUTORIALCLASS + "TUTORIAL_CLASS (must be a String)"
+ "Example: " + COMMAND_WORD + PREFIX_MODULECODE + " CS2103T "
+ PREFIX_TUTORIALCLASS + "T09";
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a class with the module code and"
+ " tutorial class specified\n"
+ "Parameters: " + PREFIX_MODULECODE + "MODULE_CODE "
+ PREFIX_TUTORIALCLASS + "TUTORIAL_CLASS "
+ PREFIX_DESCRIPTION + "[description/DESCRIPTION] (optional)\n"
+ "Example: " + COMMAND_WORD + " " + PREFIX_MODULECODE + "CS2103T "
+ PREFIX_TUTORIALCLASS + "T09 "
+ PREFIX_DESCRIPTION + "Software Engineering ";

private final ModuleCode module;
private final TutorialClass tutorialString;
private final Optional<String> description;

/**
* Constructs an AddClassCommand to add the specified {@code TutorialClass} to the specified {@code ModuleCode}.
* @param module The module code of the tutorial class to be added.
* @param tutorialClass The tutorial class to be added.
*/
public AddClassCommand(ModuleCode module, TutorialClass tutorialClass) {
public AddClassCommand(ModuleCode module, TutorialClass tutorialClass, Optional<String> description) {
requireAllNonNull(module);
this.module = module;
this.tutorialString = tutorialClass;
this.description = description;
}

@Override
Expand All @@ -51,6 +59,7 @@ public CommandResult execute(Model model) throws CommandException {
existingModule.addTutorialClass(tutorialString);
}
} else {
description.ifPresent(module::setDescription);
module.addTutorialClass(tutorialString);
model.addModule(module);
}
Expand Down Expand Up @@ -79,6 +88,6 @@ public boolean equals(Object other) {
}

AddClassCommand e = (AddClassCommand) other;
return module.equals(e.module);
return module.equals(e.module) && tutorialString.equals(e.tutorialString);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
/**
* Adds a person to TAHelper.
*/
public class AddCommand extends Command {
public class AddStudentCommand extends Command {

public static final String COMMAND_WORD = "/add_student";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a person to TAHelper. "
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a person to TAHelper.\n"
+ "Parameters: "
+ PREFIX_NAME + "NAME "
+ PREFIX_EMAIL + "EMAIL "
+ PREFIX_STUDENTID + "STUDENT ID "
+ "[" + PREFIX_TAG + "TAG]...\n"
+ "Example: " + COMMAND_WORD + " "
+ PREFIX_NAME + "Zack "
+ PREFIX_STUDENTID + "A12345678Z "
+ PREFIX_STUDENTID + "A1234567Z "
+ PREFIX_EMAIL + "[email protected] "
+ PREFIX_TAG + "Student ";

Expand All @@ -39,7 +39,7 @@ public class AddCommand extends Command {
/**
* Creates an AddCommand to add the specified {@code Person}
*/
public AddCommand(Person person) {
public AddStudentCommand(Person person) {
requireNonNull(person);
toAdd = person;
}
Expand All @@ -63,11 +63,11 @@ public boolean equals(Object other) {
}

// instanceof handles nulls
if (!(other instanceof AddCommand)) {
if (!(other instanceof AddStudentCommand)) {
return false;
}

AddCommand otherAddCommand = (AddCommand) other;
AddStudentCommand otherAddCommand = (AddStudentCommand) other;
return toAdd.equals(otherAddCommand.toAdd);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public class DeleteClassCommand extends Command {

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Deletes a class with the module code and tutorial class specified\n"
+ "Parameters:" + PREFIX_MODULECODE + "MODULE_CODE (must be a String) "
+ PREFIX_TUTORIALCLASS + "TUTORIAL_CLASS (must be a String)"
+ "Example: " + COMMAND_WORD + PREFIX_MODULECODE + " CS2103T "
+ "Parameters:" + PREFIX_MODULECODE + "MODULE_CODE "
+ PREFIX_TUTORIALCLASS + "TUTORIAL_CLASS\n"
+ "Example: " + COMMAND_WORD + " " + PREFIX_MODULECODE + " CS2103T "
+ PREFIX_TUTORIALCLASS + "T09";

private final ModuleCode module;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import seedu.address.model.person.Person;

/**
* Deletes a person identified using it's displayed index from the address book.
* Deletes a person identified using it's displayed index from tahelper system.
*/
public class DeleteCommand extends Command {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import seedu.address.model.tag.Tag;

/**
* Edits the details of an existing person in the address book.
* Edits the details of an existing person in tahelper's system
*/
public class EditCommand extends Command {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
public class ExitCommand extends Command {

public static final String COMMAND_WORD = "exit";
public static final String COMMAND_WORD = "/exit";

public static final String MESSAGE_EXIT_ACKNOWLEDGEMENT = "Exiting Address Book as requested ...";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
public class HelpCommand extends Command {

public static final String COMMAND_WORD = "help";
public static final String COMMAND_WORD = "/help";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Shows program usage instructions.\n"
+ "Example: " + COMMAND_WORD;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import seedu.address.model.Model;

/**
* Lists all modules and their associated tutorial classes in the address book to the user.
* Lists all modules and their associated tutorial classes in TAHelper to the user.
*/
public class ListClassesCommand extends Command {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
import seedu.address.model.Model;

/**
* Lists all persons in the address book to the user.
* Lists all persons in TAHelper to the user.
*/
public class ListStudentsCommand extends Command {

public static final String COMMAND_WORD = "/list_students";

public static final String MESSAGE_SUCCESS = "Listed all students";


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public abstract class DeleteStudentCommand extends Command {
public static final String COMMAND_WORD = "/delete_student";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Deletes the student identified by the student ID or email used in the displayed students list.\n"
+ "Parameters: IDENTIFIER (must be a index, valid student ID or a valid email address)\n"
+ ": Deletes the student identified by parameter in the displayed students list.\n"
+ "Parameters: index/INDEX or email/EMAIL or id/STUDENT ID\n"
+ "Example: " + COMMAND_WORD + " email/[email protected]";

public static final String MESSAGE_DELETE_PERSON_SUCCESS = "Deleted Student: %1$s";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import static java.util.Objects.requireNonNull;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DESCRIPTION;
import static seedu.address.logic.parser.CliSyntax.PREFIX_MODULECODE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TUTORIALCLASS;

import java.util.Optional;
import java.util.stream.Stream;

import seedu.address.logic.commands.AddClassCommand;
Expand All @@ -15,17 +17,18 @@


/**
* Parses input arguments and creates a new {@code RemarkCommand} object
* Parses input arguments and creates a new {@code AddClassCommandParser} object
*/
public class AddClassCommandParser implements Parser<AddClassCommand> {
/**
* Parses the given {@code String} of arguments in the context of the {@code RemarkCommand}
* and returns a {@code RemarkCommand} object for execution.
* Parses the given {@code String} of arguments in the context of the {@code AddClassCommandParser}
* and returns a {@code AddClassCommandParser} object for execution.
* @throws ParseException if the user input does not conform the expected format
*/
public AddClassCommand parse(String args) throws ParseException {
requireNonNull(args);
ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args, PREFIX_MODULECODE, PREFIX_TUTORIALCLASS);
ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args,
PREFIX_MODULECODE, PREFIX_TUTORIALCLASS, PREFIX_DESCRIPTION);

if (!arePrefixesPresent(argMultimap, PREFIX_MODULECODE, PREFIX_TUTORIALCLASS)
|| !argMultimap.getPreamble().isEmpty()) {
Expand All @@ -34,13 +37,15 @@ public AddClassCommand parse(String args) throws ParseException {

String moduleCode = argMultimap.getValue(PREFIX_MODULECODE).orElse("");
String tutorialClass = argMultimap.getValue(PREFIX_TUTORIALCLASS).orElse("");
Optional<String> description = argMultimap.getValue(PREFIX_DESCRIPTION);

if (!(ModuleCode.isValidModuleCode(moduleCode))) {
throw new ParseException(ModuleCode.MESSAGE_CONSTRAINTS);
}
if (!(TutorialClass.isValidTutorialClass(tutorialClass))) {
throw new ParseException(TutorialClass.MESSAGE_CONSTRAINTS);
}
return new AddClassCommand(new ModuleCode(moduleCode), new TutorialClass(tutorialClass));
return new AddClassCommand(new ModuleCode(moduleCode), new TutorialClass(tutorialClass), description);
}
/**
* Returns true if all the prefixes are present in the given {@code ArgumentMultimap}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import java.util.Set;
import java.util.stream.Stream;

import seedu.address.logic.commands.AddCommand;
import seedu.address.logic.commands.AddStudentCommand;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.person.Email;
import seedu.address.model.person.Name;
Expand All @@ -20,20 +20,20 @@
/**
* Parses input arguments and creates a new AddCommand object
*/
public class AddCommandParser implements Parser<AddCommand> {
public class AddStudentCommandParser implements Parser<AddStudentCommand> {

/**
* Parses the given {@code String} of arguments 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 AddCommand parse(String args) throws ParseException {
public AddStudentCommand parse(String args) throws ParseException {
ArgumentMultimap argMultimap =
ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_EMAIL, PREFIX_STUDENTID, PREFIX_TAG);

if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_EMAIL, PREFIX_STUDENTID)
|| !argMultimap.getPreamble().isEmpty()) {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddCommand.MESSAGE_USAGE));
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddStudentCommand.MESSAGE_USAGE));
}

argMultimap.verifyNoDuplicatePrefixesFor(PREFIX_NAME, PREFIX_STUDENTID, PREFIX_EMAIL);
Expand All @@ -44,7 +44,7 @@ public AddCommand parse(String args) throws ParseException {

Person person = new Person(name, email, studentId, tagList);

return new AddCommand(person);
return new AddStudentCommand(person);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import seedu.address.commons.core.LogsCenter;
import seedu.address.logic.commands.AddClassCommand;
import seedu.address.logic.commands.AddCommand;
import seedu.address.logic.commands.AddStudentCommand;
import seedu.address.logic.commands.ClearCommand;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.DeleteClassCommand;
Expand Down Expand Up @@ -59,8 +59,8 @@ public Command parseCommand(String userInput) throws ParseException {

switch (commandWord) {

case AddCommand.COMMAND_WORD:
return new AddCommandParser().parse(arguments);
case AddStudentCommand.COMMAND_WORD:
return new AddStudentCommandParser().parse(arguments);

case EditCommand.COMMAND_WORD:
return new EditCommandParser().parse(arguments);
Expand Down
1 change: 1 addition & 0 deletions src/main/java/seedu/address/logic/parser/CliSyntax.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ public class CliSyntax {
public static final Prefix PREFIX_MODULECODE = new Prefix("module/");
public static final Prefix PREFIX_TUTORIALCLASS = new Prefix("tutorial/");
public static final Prefix PREFIX_TAG = new Prefix("tag/");
public static final Prefix PREFIX_DESCRIPTION = new Prefix("description/");
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@


/**
* Parses input arguments and creates a new {@code RemarkCommand} object
* Parses input arguments and creates a new {@code DeleteClassCommandParser} object
*/
public class DeleteClassCommandParser implements Parser<DeleteClassCommand> {
/**
* Parses the given {@code String} of arguments in the context of the {@code RemarkCommand}
* and returns a {@code RemarkCommand} object for execution.
* Parses the given {@code String} of arguments in the context of the {@code DeleteClassCommandParser}
* and returns a {@code DeleteClassCommandParser} object for execution.
* @throws ParseException if the user input does not conform the expected format
*/
public DeleteClassCommand parse(String args) throws ParseException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
import seedu.address.model.person.StudentId;

/**
* Parses input arguments and creates a new DeleteCommand object
* Parses input arguments and creates a new DeleteStudentCommand object
*/
public class DeleteStudentCommandParser implements Parser<DeleteStudentCommand> {

/**
* Parses the given {@code String} of arguments in the context of the
* DeleteCommand
* and returns a DeleteCommand object for execution.
* DeleteStudentCommand
* and returns a DeleteStudentCommand object for execution.
*
* @throws ParseException if the user input does not conform the expected format
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/logic/parser/Prefix.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* A prefix that marks the beginning of an argument in an arguments string.
* E.g. 't/' in 'add James t/ friend'.
* E.g. 'tag/' in '/add_students name/john ...... tag/ friend'.
*/
public class Prefix {
private final String prefix;
Expand Down
Loading

0 comments on commit 37331ff

Please sign in to comment.