Skip to content

[CS2113-T10-2] ClassCraft#13

Open
seantankj wants to merge 434 commits into
nus-cs2113-AY2526S1:masterfrom
AY2526S1-CS2113-T10-2:master
Open

[CS2113-T10-2] ClassCraft#13
seantankj wants to merge 434 commits into
nus-cs2113-AY2526S1:masterfrom
AY2526S1-CS2113-T10-2:master

Conversation

@seantankj
Copy link
Copy Markdown

@seantankj seantankj commented Sep 18, 2025

ClassCraft is a desktop app for generating sample study plans for Computer Engineers in NUS via a Command Line Interface (CLI). It helps streamline high level module planning and completion of various specialisations and technical electives.

@seantankj seantankj changed the title Update README.md [CS2113-T10-2] ClassCraft Sep 18, 2025
danielkwan2004 pushed a commit to danielkwan2004/tp that referenced this pull request Oct 14, 2025
…remove-redundant

Refactor: prepare codebase for TP v1.0
Copy link
Copy Markdown

@okkhoy okkhoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code is generally neat.
However, documentation is lacking.
Please see my comments inline for other minor issues.

@seantankj @ashpasa @darshhs @Yeoh-Soo-Leong @Amanda-HUANG88


public class ClassCraft {
/**
* Main entry-point for the java.duke.ClassCraft application.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Header comment should be written in simple present tense. Something like "Represents the entry point"

System.out.println("Input your command! Type 'help' if you need assistance.");

Ui ui = new Ui();
StudyPlan currentStudyPlan = new StudyPlan(8);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic number here

}

@Override
public void executeCommand(seedu.classcraft.studyplan.StudyPlan studyPlan, seedu.classcraft.ui.Ui ui) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to import rather than use fully qualified names here.


public abstract class Command {

public abstract void executeCommand(StudyPlan studyPlan, Ui ui) throws Exception;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all non-trivial methods in the codebase should have header comments

public enum CommandList {
help, add, delete, view, mc, spec, exit, confirm;

public static boolean isFound(String test) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is found what?
no documentation for this method

/**
* Stores and provides access to the CEG Default Graduation Requirements
*/
public class Grad {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can try to find a better name for this class

extractModuleCodes(prerequisiteNode, prerequisites);
}

} catch (Exception e) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be too generic. suggestion: create custom exception for this

Comment on lines +79 to +88
if (node.isTextual()) {
String text = node.asText().trim();
if (text.contains(":") && !text.split(":")[0].trim().isEmpty()) {
String moduleCode = text.split(":")[0].trim();
result.add(moduleCode);
} else if (!text.isEmpty()) {
result.add(text);
}
return;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see if you can remove arrow head code

addModule(newModule, semester);

LOGGER.info("Added " + moduleCode + " to semester " + semester);
// Removed old System.out.println that used fetcher.getModulePrerequisites(moduleCode)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove such note-to-self comments

Comment on lines +11 to +120
/*
private Parser parser;
private String userInput = "null";

@BeforeEach
void setUp() {
parser = new Parser( userInput);
}

//Test for valid parsing of user input string into commandType and userInstructions
@Test
void parseInstructions_validInput() {
parser.userInputString = "help";
parser.parseInstructions();
assertEquals("help", parser.commandType);
assertNull(parser.userInstructions,
"userInstructions should be " +
"null for input 'help'.");

parser.userInputString = "exit";
parser.parseInstructions();
assertEquals("exit", parser.commandType);
assertNull(parser.userInstructions,
"userInstructions should be " +
"null for input 'exit'.");

parser.userInputString = "delete CS2113";
parser.parseInstructions();
assertEquals("delete", parser.commandType);
assertEquals("CS2113", parser.userInstructions);

parser.userInputString = "unknown arg";
parser.parseInstructions();
assertEquals("invalid", parser.commandType);

parser.userInputString = "delete ";
parser.parseInstructions();
assertEquals("invalid", parser.commandType,
"The commandType " +
"should be 'invalid' for input 'delete' without a corresponding module code.");

parser.userInputString = "";
parser.parseInstructions();
assertEquals("invalid", parser.commandType,
"The commandType " +
"should be 'invalid' for empty input.");
}

//Test for valid parsing of user instructions for view command
@Test
void parseView_validInstructions() {
parser.userInstructions = "plan";
assertEquals("plan", parser.parseView());

parser.userInstructions = "grad";
assertEquals("grad", parser.parseView());

parser.userInstructions = "sample extra arguments";
assertEquals("sample", parser.parseView());

parser.userInstructions = "invalidCommand";
assertEquals("", parser.parseView(),
"The view command should " +
"return an empty string for invalid input.");
}

//Test for valid parsing of user instructions for delete command
@Test
void parseDelete_validModuleCode() {
parser.userInstructions = "CG2111A extra arguments";
assertEquals("CG2111A", parser.parseDelete());

parser.userInstructions = null;
assertEquals("", parser.parseDelete(),
"The delete command should " +
"return an empty string for null input.");

parser.userInstructions = "";
assertEquals("", parser.parseDelete(),
"The delete command " +
"should return an empty string for empty input.");
}


//Test for valid parsing of user instructions for add command
@Test
void parseAdd_validInput() {
parser.userInstructions = "n/CG2111A s/2";
String[] result = parser.parseAdd();
assertEquals(2, result.length);
assertEquals("CG2111A", result[0]);
assertEquals("2", result[1]);

parser.userInstructions = "n/CG2111A";
assertEquals(0, parser.parseAdd().length,
"The result array " +
"should have length 0 for missing semester.");

parser.userInstructions = "s/2";
assertEquals(0, parser.parseAdd().length,
"The result array " +
"should have length 0 for missing module code.");

parser.userInstructions = null;
assertEquals(0, parser.parseAdd().length,
"The result array " +
"should have length 0 for null input.");

}
*/
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't retain commented code. you can retrieve it from git later if you need it

Yeoh-Soo-Leong and others added 30 commits November 4, 2025 00:48
Fix restoration when exemptions include prereq
Add checks for prereq when adding to exemptions
Remove empty header in DG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants