Skip to content

Commit

Permalink
Fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
rocketninja7 committed Oct 12, 2023
2 parents 817ec9e + 77812fd commit c22e9ad
Show file tree
Hide file tree
Showing 24 changed files with 387 additions and 149 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
This is **ModCraft**.<br>

ModCraft provides a fast and easy way for students to track courses to take to meet graduation requirements and plan courses to take.

Example usages:
* as a platform to plan and track your NUS modules
* as a way to keep track of your current progess in NUS,
Expand All @@ -24,7 +24,4 @@ This project is **currently ongoing** with the following features planned:
* Delete taken modules
* See taken modules



This project is based on the AddressBook-Level3 project created by the [SE-EDU initiative](https://se-education.org).

This project is based on the AddressBook-Level3 project created by the [SE-EDU initiative](https://se-education.org).
6 changes: 3 additions & 3 deletions docs/AboutUs.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ You can reach us at the email `seer[at]comp.nus.edu.sg`
<img src="images/rocketninja7.png" width="200px">

[[github](https://github.com/rocketninja7)]
[[portfolio](team/andrewyapp.md)]
[[portfolio](team/rocketninja7.md)]

- Role: Project Advisor

Expand All @@ -32,7 +32,7 @@ You can reach us at the email `seer[at]comp.nus.edu.sg`

### Wong Ji Kean

<img src="images/johndoe.png" width="200px">
<img src="images/ji-just-ji.png" width="200px">

[[github](http://github.com/ji-just-ji)]
[[portfolio](team/johndoe.md)]
Expand All @@ -53,7 +53,7 @@ You can reach us at the email `seer[at]comp.nus.edu.sg`

### Huan Yaohong

<img src="images/yh.jpg" width="200px">
<img src="images/yyyaohhh.png" width="200px">

[[github](http://github.com/yyyaohhh)]
[[portfolio](team/yyyaohhh.md)]
Expand Down
4 changes: 2 additions & 2 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ Use case resumes from step 2.

* 3a. Modcraft detects that the module is unavailable for the semester.
* 3a1. Modcraft informs the user it is unavailable
* 3a2. User searches another module
* 3a2. User searches another module
Steps 3a1 to 3a2 are repeated until the module is available
Use case resumes from step 4.

Expand All @@ -376,7 +376,7 @@ Use case ends.

* 1a. Grade is invalid
* 1a1. System shows the user the grade is invalid
* 1a2. User inputs correct grade
* 1a2. User inputs correct grade
Steps 1a1 and 1a2 are repeated until the user inputs the correct grade
Use case resumes from step 2.

Expand Down
12 changes: 6 additions & 6 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

# ModCraft User Guide

ModCraft is an app that provides a fast and easy way for students to track courses
to take to meet graduation requirements and plan courses to take. The user interacts
ModCraft is an app that provides a fast and easy way for students to track courses
to take to meet graduation requirements and plan courses to take. The user interacts
with it using a CLI, and it has a GUI created with JavaFX.

<!-- * Table of Contents -->
Expand All @@ -24,11 +24,11 @@ with it using a CLI, and it has a GUI created with JavaFX.

1. Type the command in the command box and press Enter to execute it. e.g. typing **`help`** and pressing Enter will open the help window.<br>
Some example commands you can try:

* `info CS1101S` : Shows Information about the module CS1101S

* `add CS2030S Y1S2` : Adds the module CS2030S to semester 2 in year 1

* `delete CS2040S` : Deletes the module CS2040S if present from the list of modules taken

* `exit` : Exits the app.
Expand Down Expand Up @@ -94,7 +94,7 @@ Format: `delete m/MODULE`

Examples:

* `delete GEA1000`
* `delete GEA1000`



Expand Down
Binary file added docs/images/ji-just-ji.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 removed docs/images/yh.jpg
Binary file not shown.
Binary file added docs/images/yyyaohhh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions docs/team/ji-just-ji.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Ji Kean's Project Portfolio Page


## Project ModCraft

ModCraft is an app that provides a fast and easy way for students to track courses
to take to meet graduation requirements and plan courses to take. The user interacts
## Project ModCraft

ModCraft is an app that provides a fast and easy way for students to track courses
to take to meet graduation requirements and plan courses to take. The user interacts
with it using a CLI, and it has a GUI created with JavaFX.

Given below are my contributions to the project.
Expand Down
4 changes: 2 additions & 2 deletions docs/team/andrewyapp.md → docs/team/rocketninja7.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

### Project: ModCraft

ModCraft is an app that provides a fast and easy way for students to track courses
to take to meet graduation requirements and plan courses to take. The user interacts
ModCraft is an app that provides a fast and easy way for students to track courses
to take to meet graduation requirements and plan courses to take. The user interacts
with it using a CLI, and it has a GUI created with JavaFX.

Given below are my contributions to the project.
Expand Down
4 changes: 3 additions & 1 deletion docs/team/yyyaohhh.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Project ModCraft


ModCraft is an app that provides a fast and easy way for students to track courses
to take to meet graduation requirements and plan courses to take. The user interacts
with it using a CLI, and it has a GUI created with JavaFX.
Expand Down Expand Up @@ -32,4 +33,5 @@ Given below are my contributions to the project.
- Some parts of some feature I added was adopted by several other class mates (to be added soon)

- **Tools**:
- to be added soon

- to be added soon
11 changes: 11 additions & 0 deletions src/main/java/seedu/address/logic/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.stream.Stream;

import seedu.address.logic.parser.Prefix;
import seedu.address.model.module.Module;
import seedu.address.model.person.Person;

/**
Expand Down Expand Up @@ -48,4 +49,14 @@ public static String format(Person person) {
return builder.toString();
}

public static String format(Module module) {
final StringBuilder builder = new StringBuilder();
builder.append((module.getModuleCode()))
.append("; Semester: ")
.append("Y" + module.getYearTaken() + "S" + module.getSemesterTaken())
.append("; Grade: ")
.append(module.getGrade());
return builder.toString();
}

}
47 changes: 21 additions & 26 deletions src/main/java/seedu/address/logic/commands/AddCommand.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
package seedu.address.logic.commands;

import static java.util.Objects.requireNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
import static seedu.address.logic.parser.CliSyntax.*;

import seedu.address.commons.util.ToStringBuilder;
import seedu.address.logic.Messages;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;
import seedu.address.model.person.Person;
import seedu.address.model.module.Module;

/**
* Adds a person to the address book.
Expand All @@ -22,41 +18,40 @@ public class AddCommand extends Command {

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a person to the address book. "
+ "Parameters: "
+ PREFIX_NAME + "NAME "
+ PREFIX_PHONE + "PHONE "
+ PREFIX_EMAIL + "EMAIL "
+ PREFIX_ADDRESS + "ADDRESS "
+ "[" + PREFIX_TAG + "TAG]...\n"
+ PREFIX_CODE + "Code "
+ PREFIX_YEAR + "Year "
+ PREFIX_SEMESTER + "Semester "
+ PREFIX_GRADE + "Grade "
+ "Example: " + COMMAND_WORD + " "
+ PREFIX_NAME + "John Doe "
+ PREFIX_PHONE + "98765432 "
+ PREFIX_EMAIL + "[email protected] "
+ PREFIX_ADDRESS + "311, Clementi Ave 2, #02-25 "
+ PREFIX_TAG + "friends "
+ PREFIX_TAG + "owesMoney";
+ PREFIX_CODE + "CS2103T "
+ PREFIX_YEAR + "2 "
+ PREFIX_SEMESTER + "1 "
+ PREFIX_GRADE + "B ";

public static final String MESSAGE_SUCCESS = "New person added: %1$s";
public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in the address book";
public static final String MESSAGE_SUCCESS = "New module added: %1$s";
public static final String MESSAGE_DUPLICATE_MODULE = "This module already has already been added.";

private final Person toAdd;
private final Module toAdd;

/**
* Creates an AddCommand to add the specified {@code Person}
*/
public AddCommand(Person person) {
requireNonNull(person);
toAdd = person;
public AddCommand(Module module) {
requireNonNull(module);
toAdd = module;
}

@Override
public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);

if (model.hasPerson(toAdd)) {
throw new CommandException(MESSAGE_DUPLICATE_PERSON);

if (model.hasModule(toAdd)) {
throw new CommandException(MESSAGE_DUPLICATE_MODULE);

}

model.addPerson(toAdd);
model.addModule(toAdd);
return new CommandResult(String.format(MESSAGE_SUCCESS, Messages.format(toAdd)));
}

Expand Down
38 changes: 16 additions & 22 deletions src/main/java/seedu/address/logic/parser/AddCommandParser.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
package seedu.address.logic.parser;

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
import static seedu.address.logic.parser.CliSyntax.*;


import java.util.Set;
import java.util.stream.Stream;

import seedu.address.logic.commands.AddCommand;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.person.Address;
import seedu.address.model.person.Email;
import seedu.address.model.person.Name;
import seedu.address.model.person.Person;
import seedu.address.model.person.Phone;
import seedu.address.model.tag.Tag;
import seedu.address.model.module.Grade;
import seedu.address.model.module.ModuleCode;
import seedu.address.model.module.Semester;
import seedu.address.model.module.Year;
import seedu.address.model.module.Module;

/**
* Parses input arguments and creates a new AddCommand object
Expand All @@ -31,23 +26,22 @@ public class AddCommandParser implements Parser<AddCommand> {
*/
public AddCommand parse(String args) throws ParseException {
ArgumentMultimap argMultimap =
ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS, PREFIX_TAG);
ArgumentTokenizer.tokenize(args, PREFIX_CODE, PREFIX_YEAR, PREFIX_SEMESTER, PREFIX_GRADE);

if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_EMAIL)
if (!arePrefixesPresent(argMultimap, PREFIX_CODE, PREFIX_YEAR, PREFIX_SEMESTER, PREFIX_GRADE)
|| !argMultimap.getPreamble().isEmpty()) {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddCommand.MESSAGE_USAGE));
}

argMultimap.verifyNoDuplicatePrefixesFor(PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL, PREFIX_ADDRESS);
Name name = ParserUtil.parseName(argMultimap.getValue(PREFIX_NAME).get());
Phone phone = ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get());
Email email = ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL).get());
Address address = ParserUtil.parseAddress(argMultimap.getValue(PREFIX_ADDRESS).get());
Set<Tag> tagList = ParserUtil.parseTags(argMultimap.getAllValues(PREFIX_TAG));
argMultimap.verifyNoDuplicatePrefixesFor( PREFIX_CODE, PREFIX_YEAR, PREFIX_SEMESTER, PREFIX_GRADE);
ModuleCode code = ParserUtil.parseCode(argMultimap.getValue(PREFIX_CODE).get());
Year year = ParserUtil.parseYear(argMultimap.getValue(PREFIX_YEAR).get());
Semester semester = ParserUtil.parseSem(argMultimap.getValue(PREFIX_SEMESTER).get());
Grade grade = ParserUtil.parseGrade(argMultimap.getValue(PREFIX_GRADE).get());

Person person = new Person(name, phone, email, address, tagList);
Module module = new Module(code, year, semester, grade);

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

/**
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/seedu/address/logic/parser/CliSyntax.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ public class CliSyntax {
public static final Prefix PREFIX_ADDRESS = new Prefix("a/");
public static final Prefix PREFIX_TAG = new Prefix("t/");

public static final Prefix PREFIX_CODE = new Prefix("c/");
public static final Prefix PREFIX_YEAR = new Prefix("y/");
public static final Prefix PREFIX_SEMESTER = new Prefix("s/");
public static final Prefix PREFIX_GRADE = new Prefix("g/");

}
48 changes: 47 additions & 1 deletion src/main/java/seedu/address/logic/parser/ParserUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@
import seedu.address.commons.core.index.Index;
import seedu.address.commons.util.StringUtil;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.Model;
import seedu.address.model.module.ModuleCode;
import seedu.address.model.module.Year;
import seedu.address.model.module.Semester;
import seedu.address.model.module.Grade;
import seedu.address.model.module.Name;
import seedu.address.model.module.Description;
import seedu.address.model.person.Address;
import seedu.address.model.person.Email;
import seedu.address.model.person.Name;
import seedu.address.model.person.Phone;
import seedu.address.model.tag.Tag;


/**
* Contains utility methods used for parsing strings in the various *Parser classes.
*/
Expand All @@ -41,6 +48,7 @@ public static Index parseIndex(String oneBasedIndex) throws ParseException {
*
* @throws ParseException if the given {@code name} is invalid.
*/
/*
public static Name parseName(String name) throws ParseException {
requireNonNull(name);
String trimmedName = name.trim();
Expand All @@ -50,6 +58,8 @@ public static Name parseName(String name) throws ParseException {
return new Name(trimmedName);
}
*/

/**
* Parses a {@code String phone} into a {@code Phone}.
* Leading and trailing whitespaces will be trimmed.
Expand Down Expand Up @@ -121,4 +131,40 @@ public static Set<Tag> parseTags(Collection<String> tags) throws ParseException
}
return tagSet;
}

public static ModuleCode parseCode(String code) throws ParseException {
requireNonNull(code);
String trimmedCode = code.trim();
if (!ModuleCode.isValidModuleCode(trimmedCode)) {
throw new ParseException(ModuleCode.MESSAGE_CONSTRAINTS);
}
return new ModuleCode(trimmedCode);
}

public static Year parseYear(String year) throws ParseException {
requireNonNull(year);
String trimmedYear = year.trim();
if (!Year.isValidYear(trimmedYear)) {
throw new ParseException(Year.MESSAGE_CONSTRAINTS);
}
return new Year(trimmedYear);
}

public static Semester parseSem(String sem) throws ParseException {
requireNonNull(sem);
String trimmedSem = sem.trim();
if (!Semester.isValidSemester(trimmedSem)) {
throw new ParseException(Semester.MESSAGE_CONSTRAINTS);
}
return new Semester(trimmedSem);
}

public static Grade parseGrade(String grade) throws ParseException {
requireNonNull(grade);
String trimmedGrade = grade.trim();
if (!Grade.isValidGrade(trimmedGrade)) {
throw new ParseException(Grade.MESSAGE_CONSTRAINTS);
}
return new Grade(trimmedGrade);
}
}
Loading

0 comments on commit c22e9ad

Please sign in to comment.