Skip to content

Commit

Permalink
Merge pull request #96 from YeoBohShin/branch-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
ngeeyonglim authored Oct 24, 2023
2 parents 0004b7a + f10926f commit 38baca2
Show file tree
Hide file tree
Showing 27 changed files with 450 additions and 40 deletions.
6 changes: 3 additions & 3 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ _{Explain here how the data archiving feature will be implemented}_
* prefers typing to mouse interactions
* is reasonably comfortable using CLI apps

**Value proposition**:
**Value proposition**:

* provide fast access to student’s contact information
* provide easy ways to compare and visualise student's grades across classes
Expand Down Expand Up @@ -372,7 +372,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
* 3a1. ClassManager shows an error message.

Use case resumes at step 2.

* 3b. The student already has the given tag.

* 3b1. ClassManager shows an error message.
Expand Down Expand Up @@ -421,7 +421,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli

**Extensions**

* 3a. The JSON file cannot be found
* 3a. The JSON file cannot be found
* 3a1. ClassManager shows an error message.

Use case resumes at step 2.
Expand Down
14 changes: 7 additions & 7 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ Tags the existing student in the address book.

Format: `tag STUDENT_NUMBER [/add] [/delete] t/[TAG]…​`

* Tags the student with the specified `STUDENT_NUMBER`.
* Tags the student with the specified `STUDENT_NUMBER`.
* When editing tags without `/add` or `/delete`, the existing tags of the student will be removed.
* You can remove all the student’s tags by typing without `/add` and `/delete`
* You can remove all the student’s tags by typing without `/add` and `/delete`
and `t/` without specifying any tags after it.

Examples:
Expand All @@ -137,8 +137,8 @@ Examples:

**TL;DR:** Lookup student details containing any of the given fields.

This feature in Class Manager 2023 is a robust tool that empowers CS2103T TAs to
efficiently search for and access student information based on specific criteria.
This feature in Class Manager 2023 is a robust tool that empowers CS2103T TAs to
efficiently search for and access student information based on specific criteria.
This feature offers both broad and granular search capabilities, enabling TAs to
list all students from a particular class or narrow down their search by providing
one or more lookup parameters.
Expand Down Expand Up @@ -174,15 +174,15 @@ Format: `mark TUTORIAL_INDEX s/STUDENT_NUMBER`
* The TUTORIAL_INDEX must be a valid positive integer.

Examples:
* `mark 1 s/A0249112A`
* `mark 1 s/A0249112A`

### Deleting a student : `delete`

Deletes the specific student.

Format: `delete s/STUDENT_NUMBER`

* The STUDENT NUMBER must be valid and exist.
* The STUDENT NUMBER must be valid and exist.

Examples:
* `delete s/A0249112A`
Expand Down Expand Up @@ -226,7 +226,7 @@ Examples:

### Configuring Class Manager: `config`

Configures Class Manager 2023 with the module information, such as tutorial count and assignment count.
Configures Class Manager 2023 with the module information, such as tutorial count and assignment count.

Format: `config #t/TUTORIAL_COUNT #a/ASSIGNMENT_COUNT`
* Parameters can be in any order.
Expand Down
14 changes: 7 additions & 7 deletions docs/team/lwz19.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: "Wen Zhong's Project Portfolio Page"

### Project: Class Manager 2023

Class Manager 2023 is a desktop address book application used for TA to manage their students' details.
Class Manager 2023 is a desktop address book application used for TA to manage their students' details.
The user interacts with it using a CLI, and it has a GUI created with JavaFX. It is written in Java, and has about 10 kLoC.

Given below are my contributions to the project.
Expand All @@ -25,28 +25,28 @@ Given below are my contributions to the project.
_To be added soon_
<br/><br/>

* **Code contributed**:
* **Code contributed**:
* [Individual Dashboard](https://nus-cs2103-ay2324s1.github.io/tp-dashboard/?search=lwz19&breakdown=true)
<br/><br/>

* **Project management**:
* _To be added soon_
<br/><br/>

* **Enhancements to existing features**:
* _To be added soon_
<br/><br/>

* **Documentation**:
* User Guide:
* _To be added soon_
* Developer Guide:
* _To be added soon_
<br/><br/>

* **Community**:
* _To be added soon_
* _To be added soon_
<br/><br/>

* **Tools**:
* _To be added soon_
6 changes: 6 additions & 0 deletions src/main/java/seedu/address/logic/Logic.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public interface Logic {
/** Returns an unmodifiable view of the filtered list of students */
ObservableList<Student> getFilteredStudentList();

/** Returns view of selected student. */
ObservableList<Student> getSelectedStudent();

/** Sets a student to be selected to view class details. */
void setSelectedStudent(Student student);

/**
* Returns the user prefs' address book file path.
*/
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/seedu/address/logic/LogicManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ public ObservableList<Student> getFilteredStudentList() {
return model.getFilteredStudentList();
}

@Override
public ObservableList<Student> getSelectedStudent() {
return model.getSelectedStudent();
}

@Override
public void setSelectedStudent(Student student) {
model.setSelectedStudent(student);
}

@Override
public Path getAddressBookFilePath() {
return model.getAddressBookFilePath();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public CommandResult execute(Model model) throws CommandException {
Student editedStudent = new Student(
studentToTag.getName(), studentToTag.getPhone(), studentToTag.getEmail(),
studentToTag.getStudentNumber(), studentToTag.getClassDetails(), newTags);

model.setStudent(studentToTag, editedStudent);
model.updateFilteredStudentList(Model.PREDICATE_SHOW_ALL_STUDENTS);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Records the class participation for a student in a specific tutorial session.
*/
public class RecordClassPartCommand extends Command {

public static final String COMMAND_WORD = "record-part";

public static final String MESSAGE_USAGE = COMMAND_WORD
Expand All @@ -32,7 +33,6 @@ public class RecordClassPartCommand extends Command {
public static final String MESSAGE_SUCCESS = "Recorded participation for student: %1$s, "
+ "here are the details:\n";


private final StudentNumber studentNumber;
private final int sessionNumber;
private final boolean isParticipated;
Expand All @@ -54,15 +54,17 @@ public CommandResult execute(Model model) throws CommandException {
throw new CommandException(Messages.MESSAGE_NONEXISTENT_STUDENT_NUMBER);
}

Student studentToGrade = model.getStudent(studentNumber);
ClassDetails classDetails = studentToGrade.getClassDetails();
Student studentToMark = model.getStudent(studentNumber);
ClassDetails classDetails = studentToMark.getClassDetails();
classDetails.recordClassPart(sessionNumber, isParticipated);
Student markedStudent = new Student(studentToMark.getName(), studentToMark.getPhone(),
studentToMark.getEmail(), studentToMark.getStudentNumber(), classDetails, studentToMark.getTags());

model.setStudent(studentToMark, markedStudent);
return new CommandResult(String.format(MESSAGE_SUCCESS, studentNumber)
+ classDetails.displayParticipations());
}


@Override
public boolean equals(Object other) {
if (other == this) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ public CommandResult execute(Model model) throws CommandException {
Student studentToGrade = model.getStudent(studentNumber);
ClassDetails classDetails = studentToGrade.getClassDetails();
classDetails.setAssignGrade(assignmentNumber, grade);
Student gradedStudent = new Student(studentToGrade.getName(), studentToGrade.getPhone(),
studentToGrade.getEmail(), studentToGrade.getStudentNumber(), classDetails, studentToGrade.getTags());

model.setStudent(studentToGrade, gradedStudent);
return new CommandResult(String.format(MESSAGE_SUCCESS, studentNumber)
+ classDetails.displayAssignments());
}
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/seedu/address/model/AddressBook.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public AddressBook(ReadOnlyAddressBook toBeCopied) {
*/
public void setStudents(List<Student> students) {
this.students.setStudents(students);
if (!students.isEmpty()) {
this.students.setSelectedStudent(students.get(0));
}
}

/**
Expand All @@ -55,6 +58,9 @@ public void setStudents(List<Student> students) {
public void resetData(ReadOnlyAddressBook newData) {
requireNonNull(newData);
setStudents(newData.getStudentList());
if (!newData.getSelectedStudent().isEmpty()) {
setSelectedStudent(newData.getSelectedStudent().get(0));
}
}

//// student-level operations
Expand Down Expand Up @@ -105,6 +111,15 @@ public void removeStudent(Student key) {
students.remove(key);
}

/**
* Sets the student to be the selected student.
*
* @param student to be selected
*/
public void setSelectedStudent(Student student) {
students.setSelectedStudent(student);
}

//// util methods

@Override
Expand All @@ -119,6 +134,11 @@ public ObservableList<Student> getStudentList() {
return students.asUnmodifiableObservableList();
}

@Override
public ObservableList<Student> getSelectedStudent() {
return students.getSelectedStudent();
}

@Override
public boolean equals(Object other) {
if (other == this) {
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/seedu/address/model/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ public interface Model {
/** Returns an unmodifiable view of the filtered student list */
ObservableList<Student> getFilteredStudentList();

/** Returns view of selected student. */
ObservableList<Student> getSelectedStudent();

/** Sets a student to be selected to view class details. */
void setSelectedStudent(Student student);

/**
* Updates the filter of the filtered student list to filter by the given {@code predicate}.
* @throws NullPointerException if {@code predicate} is null.
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/seedu/address/model/ModelManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ public Student getStudent(StudentNumber studentNumber) {
return addressBook.getStudent(studentNumber);
}

@Override
public void setSelectedStudent(Student student) {
addressBook.setSelectedStudent(student);
}
//=========== Filtered Student List Accessors =============================================================

/**
Expand All @@ -167,10 +171,18 @@ public ObservableList<Student> getFilteredStudentList() {
return filteredStudents;
}

@Override
public ObservableList<Student> getSelectedStudent() {
return addressBook.getSelectedStudent();
}

@Override
public void updateFilteredStudentList(Predicate<Student> predicate) {
requireNonNull(predicate);
filteredStudents.setPredicate(predicate);
if (!filteredStudents.isEmpty()) {
addressBook.setSelectedStudent(filteredStudents.get(0));
}
}

@Override
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/seedu/address/model/ReadOnlyAddressBook.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@ public interface ReadOnlyAddressBook {
*/
ObservableList<Student> getStudentList();

/**
* Returns the list containing the selected student.
* The list only has one selected student.
*/
ObservableList<Student> getSelectedStudent();

}
31 changes: 30 additions & 1 deletion src/main/java/seedu/address/model/student/UniqueStudentList.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
* persons uses Student#isSamePerson(Student) for equality so as to ensure that the student being added or updated is
* unique in terms of identity in the UniqueStudentList. However, the removal of a student uses
* Student#equals(Object) so as to ensure that the student with exactly the same fields will be removed.
*
* Supports a minimal set of list operations.
*
* @see Student#isSameStudent(Student)
Expand All @@ -28,6 +27,8 @@ public class UniqueStudentList implements Iterable<Student> {
private final ObservableList<Student> internalList = FXCollections.observableArrayList();
private final ObservableList<Student> internalUnmodifiableList =
FXCollections.unmodifiableObservableList(internalList);
private final ObservableList<Student> selectedStudent =
FXCollections.observableArrayList();

/**
* Returns true if the list contains an equivalent student as the given argument.
Expand Down Expand Up @@ -109,13 +110,41 @@ public void setStudents(List<Student> students) {
internalList.setAll(students);
}

/**
* Replace the selected student with the input student.
* @param student to be selected
*/
public void setSelectedStudent(Student student) {
requireNonNull(student);
if (selectedStudent.isEmpty()) {
selectedStudent.add(student);
} else {
selectedStudent.set(0, student);
}
}

/**
* Clears the selection of a student so that no student is currently selected.
*/
public void clearSelectedStudent() {
selectedStudent.clear();
}


/**
* Returns the backing list as an unmodifiable {@code ObservableList}.
*/
public ObservableList<Student> asUnmodifiableObservableList() {
return internalUnmodifiableList;
}

/**
* Returns the {@code ObservableList} containing the selected student.
*/
public ObservableList<Student> getSelectedStudent() {
return selectedStudent;
}

@Override
public Iterator<Student> iterator() {
return internalList.iterator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public double getPercentage() {

@Override
public String toString() {
StringBuilder ret = new StringBuilder("Class Part Tracker:\n");
StringBuilder ret = new StringBuilder("Class Part:\n");
for (int i = 0; i < classPartList.length; i++) {
ret.append("Tutorial ").append(i + 1).append(": ").append(classPartList[i].toString()).append("\n");
}
Expand Down
Loading

0 comments on commit 38baca2

Please sign in to comment.