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

Bad FlashCards/ Deadline - v1.3 #150

Merged
merged 8 commits into from
Oct 30, 2019

Conversation

dalsontws
Copy link
Collaborator

@dalsontws dalsontws commented Oct 28, 2019

  • Add 'Bad' FlashCard as a Deadline on the list

  • Store 'Bad' FlashCards in Json

  • Add Tests for 'Bad' Command

  • Integrate 'Bad' Command with Edit and Add FlashCard Commands

@@ -30,6 +30,9 @@ public DeadlinePanel(Deadline deadline, int displayedIndex) {
this.deadline = deadline;
id.setText(displayedIndex + ". ");
task.setText(deadline.getTask().toString());
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can change the task from label to Textflow so that the text will not be concatenated and you can change the color of the text.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nice, thanks!

Comment on lines +49 to +76
requireNonNull(model);
List<FlashCard> lastShownList = model.getFilteredFlashCardList();
if (index.getZeroBased() >= lastShownList.size()) {
throw new CommandException(Messages.MESSAGE_INVALID_FLASHCARD_DISPLAYED_INDEX);
}

FlashCard badFlashcard = lastShownList.get(index.getZeroBased());

Task task = new Task("To Do: Bad Questions");
DueDate d = BadQuestions.getBadDeadline();
Deadline deadline = new Deadline(task, d);

//TODO: add questions and due date into filtered bad flashcards list
Question q = badFlashcard.getQuestion();

BadQuestions badQuestions = new BadQuestions();

badQuestions.addBadQuestion(d, q);

badQuestions.saveAsJson(badQuestions);

try {
model.addDeadline(deadline);
} catch (DuplicateDeadlineException e) {
return new CommandResult(DUPLICATE_DEADLINE);
}

return new CommandResult(MESSAGE_SUCCESS);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider SLAPing it

@@ -0,0 +1,31 @@
//@@author: dalsontws
Copy link
Collaborator

Choose a reason for hiding this comment

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

Correct format is //@@author dalsontws

Comment on lines 66 to 70
// convert java object to JSON format,
// and returned as JSON formatted string
String json = gson.toJson(badQuestions.getBadQuestionsList());
try {
//write converted json data to a file
Copy link
Collaborator

Choose a reason for hiding this comment

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

Writing a method to abstract these steps might be better than to explain it through comments

@dalsontws dalsontws merged commit ae19137 into AY1920S1-CS2103T-T12-4:master Oct 30, 2019
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.

None yet

3 participants