Skip to content

Commit

Permalink
Fix Bugs from PE
Browse files Browse the repository at this point in the history
  • Loading branch information
Yufannnn committed Apr 1, 2023
1 parent 1fb2fcb commit 6f63201
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 16 deletions.
24 changes: 16 additions & 8 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ TutorPro is a **desktop app designed to help private tutors manage their student

3. Copy the file to the folder you want to use as the _home folder_ for your address book.

4. Open a command terminal, `cd` into the folder in which you put the jar file, and use the `java -jar addressbook.jar` command to run the application.<br>
4. Open a command terminal, `cd` into the folder in which you put the jar file, and use the `java -jar TutorPro.jar` command to run the application.<br>
A GUI similar to the one below should appear in a few seconds. Note how the app contains some sample data.<br>
![Ui](images/Ui.png)

5. 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>

6. Refer to the [Features](#features) below for details of each command.
6. Refer to the Features below for details of each command.

--------------------------------------------------------------------------------------------------------------------
### Glossary
Expand Down Expand Up @@ -63,7 +63,7 @@ When you first run the app, you may see a display window pop up similar to the o

You may enter the following commands in the Command Box to see how the Display List changes:
* `list` lists all students.
* `delete-b 1` deletes the student with index 1.
* `delete 1` deletes the student with index 1.
* `view-homework` displays all the homework from all students.

You may also click the quick access buttons one each student card to see how the Detailed Information Section changes.
Expand Down Expand Up @@ -128,7 +128,6 @@ Example:
* SCHOOL and GRADE_LEVEL are optional.
* SCHOOL and GRADE_LEVEL consist of numbers and letters only (no symbols or spaces).


### Update Student Information

Updates the student's information given the student's label, field to change, and updated field value
Expand All @@ -145,7 +144,7 @@ Examples:
* `update-info name/John f/address v/Block 123 #12-34` Updates student info and displays the new value to the user.


### Assign Homework to a Student
### Create New Homework to a Student

Creates a homework assignment with a deadline for a student

Expand All @@ -156,8 +155,9 @@ Format: `new-homework [name/STUDENT_NAME] [homework/HOMEWORK_NAME] [deadline/DEA
* The `DEADLINE` must be in the future.

Examples:
* `assign-homework name/John homework/listening comprehension ex1 deadline/02-12-2023-2359` adds the assignment `listening comprehension ex1` to the student named `John. The deadline is 02 Dec 2023 at 23:25.
* `new-homework name/John homework/listening comprehension ex1 deadline/2023-04-30 2359` adds the assignment `listening comprehension ex1` to the student named `John. The deadline is 02 Dec 2023 at 23:25.

:exclamation: **Caution:** STUDENT_NAME is case-sensitive and supports partial matching. For example, `John` will match `John Doe` but not `john`.

:exclamation: **Caution:** STUDENT_NAME, HOMEWORK_INDEX , and DEADLINE should all only appear at most once and should not be empty.

Expand All @@ -180,6 +180,8 @@ Examples:
* `view-homework status/completed` displays all completed homework from all students.
* `view-homework name/John status/pending` displays pending homework for a student named `John`.

:exclamation: **Caution:** STUDENT_NAME is case-sensitive and supports partial matching. For example, `John` will match `John Doe` but not `john`.

:exclamation: **Caution:** STATUS should only appear at most once and should not be empty. STUDENT_NAME can be zero or multiple but they all cannot be empty.

### Delete Homework from a Student
Expand All @@ -197,6 +199,8 @@ Examples:
* `delete-homework name/John index/1` deletes the first homework assignment for the student named John.
* `delete-homework name/Susan index/3` deletes the third homework assignment for the student named Susan.

:exclamation: **Caution:** STUDENT_NAME is case-sensitive and supports partial matching. For example, `John` will match `John Doe` but not `john`.

:exclamation: **Caution:** STUDENT_NAME, and HOMEWORK_INDEX should all only appear at most once and should not be empty.

### Mark the Homework of a Student as Done
Expand All @@ -214,8 +218,9 @@ Examples:
* `mark-homework name/John index/1` marks the first homework assignment for the student named John.
* `mark-homework name/Susan index/3` marks the third homework assignment for the student named Susan.

:exclamation: **Caution:** STUDENT_NAME, and HOMEWORK_INDEX should all only appear at most once and should not be empty.
:exclamation: **Caution:** STUDENT_NAME is case-sensitive and supports partial matching. For example, `John` will match `John Doe` but not `john`.

:exclamation: **Caution:** STUDENT_NAME, and HOMEWORK_INDEX should all only appear at most once and should not be empty.

### Unmark Homework of a Student as Undone

Expand All @@ -232,6 +237,8 @@ Examples:
* `unmark-homework name/John index/1`unmarks the first homework assignment for the student named John.
* `unmark-homework name/Susan index/3` unmarks the third homework assignment for the student named Susan.

:exclamation: **Caution:** STUDENT_NAME is case-sensitive and supports partial matching. For example, `John` will match `John Doe` but not `john`.

:exclamation: **Caution:** STUDENT_NAME, and HOMEWORK_INDEX should all only appear at most once and should not be empty.

### Update Homework of a Student
Expand All @@ -253,6 +260,8 @@ Examples:
* `updates-homework name/Susan index/3 deadline/2023-05-12 23:59` updates the deadline of homework 3 of Susan to be `2023-05-12 23:59`.
* `updates-homework name/Donald index/2 homework/Math Assignment 1 deadline/2023-05-12 23:59` updates the name of homework 2 of Donald to be `Math Assignment 1` and updates the deadline of homework 2 of Donald to be `2023-05-12 23:59`.

:exclamation: **Caution:** STUDENT_NAME is case-sensitive and supports partial matching. For example, `John` will match `John Doe` but not `john`.

:exclamation: **Caution:** STUDENT_NAME, HOMEWORK_INDEX , and DEADLINE should all only appear at most once and should not be empty.

### Create a New Lesson Plan for the Upcoming Lesson
Expand Down Expand Up @@ -424,4 +433,3 @@ Examples:
* `dd MMM yyyy HH:mm `
* `MMM dd, yyyy HHmm`
* `MMM dd, yyyy HH:mm `
* `dd-mm-yyyy HHmm`
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public CommandResult execute(Model model) throws CommandException {
String newHomeworkName = this.homeworkName.orElse(homeworkToUpdate.getDescription());
LocalDateTime newDeadline = this.deadline.orElse(homeworkToUpdate.getDeadline());
Homework newHomework = new Homework(newHomeworkName, newDeadline);
if (homeworkToUpdate.isCompleted()) {
newHomework.markAsDone();
}
updateHomework(student, homeworkToUpdate, newHomework);

return new CommandResult(
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/seedu/address/logic/parser/ParserUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ public class ParserUtil {
"yyyy/MM/dd'T'HH:mm", "yyyy-MM-dd HHmm",
"yyyy-MM-dd HH:mm", "dd MMM yyyy HHmm",
"dd MMM yyyy HH:mm", "MMM dd, yyyy HHmm",
"MMM dd, yyyy HH:mm", "dd-mm-yyyy HHmm"
"MMM dd, yyyy HH:mm"
};
//@@author


/**
* Parses {@code oneBasedIndex} into an {@code Index} and returns it. Leading and trailing whitespaces will be
* trimmed.
Expand Down Expand Up @@ -432,4 +433,5 @@ public static Grade parseGrade(String grade) throws ParseException {
}
return res;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public CreateExamCommand parse(String args) throws ParseException {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
CreateExamCommand.MESSAGE_USAGE));
}
LocalDateTime startTime = ParserUtil.parseDeadline(argMultimap.getValue(PREFIX_STARTTIME).get());
LocalDateTime endTime = ParserUtil.parseDeadline(argMultimap.getValue(PREFIX_ENDTIME).get());
LocalDateTime startTime = ParserUtil.parseStartTime(argMultimap.getValue(PREFIX_STARTTIME).get());
LocalDateTime endTime = ParserUtil.parseEndTime(argMultimap.getValue(PREFIX_ENDTIME).get());
List<String> nameKeywords = argMultimap.getAllValues(PREFIX_NAME);

Double weightage = null;
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/seedu/address/ui/exam/ExamCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
import seedu.address.model.student.Exam;
import seedu.address.ui.UiPart;

import java.time.format.DateTimeFormatter;

/**
* A UI component that displays information of a {@code Person}.
*/
public class ExamCard extends UiPart<Region> {

private static final DateTimeFormatter PRINT_FORMATTER = DateTimeFormatter.ofPattern("dd MMM yyyy HH:mm");
private static final String FXML = "ExamListCard.fxml";

@FXML
Expand All @@ -35,8 +37,8 @@ public ExamCard(Exam exam, int id) {
super(FXML);
this.id.setText(id + ". ");
title.setText(exam.getDescription());
startTime.setText(exam.getStartTime().toString());
endTime.setText(exam.getEndTime().toString());
startTime.setText(exam.getStartTime().format(PRINT_FORMATTER));
endTime.setText(exam.getEndTime().format(PRINT_FORMATTER));
}

@Override
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/seedu/address/ui/lesson/LessonCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
import seedu.address.model.student.Lesson;
import seedu.address.ui.UiPart;

import java.time.format.DateTimeFormatter;

/**
* A UI component that displays information of a {@code Person}.
*/
public class LessonCard extends UiPart<Region> {
private static final DateTimeFormatter PRINT_FORMATTER = DateTimeFormatter.ofPattern("dd MMM yyyy HH:mm");
private static final String FXML = "LessonListCard.fxml";
private static final String DOT = ". ";

Expand All @@ -35,8 +38,8 @@ public LessonCard(Lesson lesson, int id) {
super(FXML);
this.id.setText(id + DOT);
title.setText(lesson.getTitle());
startTime.setText(lesson.getStartTimeString());
endTime.setText(lesson.getEndTimeString());
startTime.setText(lesson.getStartTime().format(PRINT_FORMATTER));
endTime.setText(lesson.getEndTime().format(PRINT_FORMATTER));
}

@Override
Expand Down

0 comments on commit 6f63201

Please sign in to comment.