Skip to content

Commit

Permalink
Merge branch 'master' into branch-documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
SinhaVedant committed Nov 13, 2023
2 parents c46dcfc + 6a2c899 commit ab8e4be
Show file tree
Hide file tree
Showing 79 changed files with 2,114 additions and 372 deletions.
36 changes: 35 additions & 1 deletion docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ How the parsing works:
Note that Student, StudentGrade and GradeComponent classes have similar structures and dependencies, thus, we use Ssc class to represent these three and their related classes in the class diagram above.

Here are the class diagrams for Ssc (Student, StudentGrade, GradedComponent) classes respectively.
<puml src="diagrams/StudentModelDiagram.puml" width="450" />
<puml src="diagrams/StudentModelDiagram.puml" width="450" /> <br>
<puml src="diagrams/StudentScoreModelDiagram.puml" width="300" />
<puml src="diagrams/GradedComponentModelDiagram.puml" width="300" />

Expand Down Expand Up @@ -185,6 +185,40 @@ Classes used by multiple components are in the `seedu.modulight.commons` package

This section describes some noteworthy details on how certain features are implemented.

### Sort Commands

The Sort related feature allows NUS professors to sort the currently displayed students or student scores. When successfully executed, the sorted students or student scores will be shown on the Graphical User Interface. <br>

We will discuss the implementation of sortScore (Sort Student Scores) command here and omit the discussion of the implementation of sortStu command since it is very similar to sortScore command and simpler.

#### Implementation

The `sortScoreCommand` (Sort Student Scores) mechanism is facilitated by GradedComponentBook, StudentBook and StudentScoreBook. It implements the following operations:

* `GradedComponentBook#hasGc(GcName gcName)` - Returns true if a graded component is already created and in the graded component list.
* `studentScoreBook.sortStudentScore(Boolean isReverse)` - Filters the student scores with the given graded component and sort them according to the given reverse order.
* `studentBook.sortStudentScore(GcName gcName, Boolean isReverse)` - Sorts students by their scores in a given graded component.

Given below is an example usage scenario and how the `sortScore` mechanism behaves at each step.

Step 1. The GUI displayed the list of students and their student scores that the user wants to sort after some `find` or `list` commands.

Step 2. The user executes `sortStuScore c/Midterm` command to sort the current displayed lists of students and student scores. The `sortStuScore` command calls SortStudentScoreCommandParser#parse() which parses the string keyed into the command line of the GUI.

Step 3. `SortStudentScoreCommandParser#parse()` invokes the creation of a `SortStudentScoreCommand` object.
> **Note**: If a command fails its execution due to incorrect command format, it will not create a `SortStudentScoreCommand` object, an error message will be displayed and user will retype their command.
Step 4. Upon creation and execution of `SortStudentScoreCommand` object, `GradedComponentBook#hasGc(GcName gcName)`, `studentScoreBook.sortStudentScore(Boolean isReverse)` and `studentBook.sortStudentScore(GcName gcName, Boolean isReverse)` methods are called.
> **Note**: If upon invoking `GradedComponentBook#hasGc(GcName gcName)` method and return value is false, it will throw an error and will not call the remaining two methods, so the students and student scores will not be sorted.
Step 5. After successfully sorting student scores and their associated students, a `CommandResult` object will be created to tell the user that the student scores has been successfully sorted.

The following sequence diagram shows how the sort student scores operation works:<br>

<puml src="diagrams/SortScoreCommandSequenceDiagram.puml" alt="SortScoreCommandSequenceDiagram"></puml>

The following activity diagram summarizes what happens when a user executes a new sortScore command:<br>
<puml src="diagrams/SortScoreCommandActivityDiagram.puml" alt="SortScoreActivityDiagram" />

### Auto-grading

Expand Down
378 changes: 201 additions & 177 deletions docs/UserGuide.md

Large diffs are not rendered by default.

Binary file modified docs/diagrams/BetterModelClassDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 11 additions & 10 deletions docs/diagrams/BetterModelClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ skinparam arrowThickness 1.1
skinparam arrowColor MODEL_COLOR
skinparam classBackgroundColor MODEL_COLOR

AddressBook *-right-> "1" UniquePersonList
AddressBook *-right-> "1" UniqueTagList
UniqueTagList -[hidden]down- UniquePersonList
UniqueTagList -[hidden]down- UniquePersonList
StudentBook *-right-> "1" UniqueStudentList
StudentBook *-right-> "1" UniqueTagList
UniqueTagList -[hidden]down- UniqueStudentList
UniqueTagList -[hidden]down- UniqueStudentList

UniqueTagList -right-> "*" Tag
UniquePersonList -right-> Person
UniqueStudentList -right-> Student

Person -up-> "*" Tag
Student -up-> "*" Tag

Person *--> Name
Person *--> Phone
Person *--> Email
Person *--> Address
Student *--> StudentName
Student *--> StudentId
Student *--> StudentEmail
Student *--> TutorialGroup
Student *--> StudentGrade
@enduml
Binary file added docs/diagrams/SortScoreAcitivityDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions docs/diagrams/SortScoreAcitivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@startuml
'https://plantuml.com/activity-diagram-beta

start
:User executes sortScore command;
if () then ([given graded component exists])
:student scores filtered and sorted;
:students sorted accordingly;
else ([else])
:a error message shows up;
:user retypes the command;
endif

:Updated students and student scores list saved to ModuLight;

stop

@enduml
Binary file added docs/diagrams/SortScoreCommandSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions docs/diagrams/SortScoreCommandSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
@startuml
!include style.puml

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":ModuLightParser" as ModuLightParser LOGIC_COLOR
participant ":SortStudentScoreCommandParser" as SortStudentScoreCommandParser LOGIC_COLOR
participant "a:SortStudentScoreCommand" as SortStudentScoreCommand LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
end box
[-> LogicManager : execute(sortScore c/Midterm)
activate LogicManager

LogicManager -> ModuLightParser : parseCommand(sortScore c/Midterm)
activate ModuLightParser

create SortStudentScoreCommandParser
ModuLightParser -> SortStudentScoreCommandParser :SortStudentScoreCommandParser()
activate SortStudentScoreCommandParser

SortStudentScoreCommandParser --> ModuLightParser
deactivate SortStudentScoreCommandParser

ModuLightParser -> SortStudentScoreCommandParser : parse(" c/Midterm")
activate SortStudentScoreCommandParser

create SortStudentScoreCommand
SortStudentScoreCommandParser -> SortStudentScoreCommand
activate SortStudentScoreCommand

SortStudentScoreCommand --> SortStudentScoreCommandParser : s
deactivate SortStudentScoreCommand

SortStudentScoreCommandParser --> ModuLightParser : s
deactivate SortStudentScoreCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
SortStudentScoreCommandParser -[hidden]-> ModuLightParser
destroy SortStudentScoreCommandParser

ModuLightParser --> LogicManager : s
deactivate ModuLightParser

LogicManager -> SortStudentScoreCommand : execute()
activate SortStudentScoreCommand

SortStudentScoreCommand -> Model : hasGc(GcName gcName)
activate Model

Model --> SortStudentScoreCommand
deactivate Model

SortStudentScoreCommand -> Model : sortStudentScore(GcName gcName, Boolean isReverse)
activate Model


Model --> SortStudentScoreCommand
deactivate Model

SortStudentScoreCommand --> LogicManager : result
deactivate SortStudentScoreCommand
SortStudentScoreCommand -[hidden]-> LogicManager : result
destroy SortStudentScoreCommand

[<--LogicManager
deactivate LogicManager
@enduml
Binary file modified docs/diagrams/UndoSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 14 additions & 14 deletions docs/diagrams/UndoSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,42 @@ skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant ":ModuLightParser" as ModuLightParser LOGIC_COLOR
participant "u:UndoCommand" as UndoCommand LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
participant ":VersionedAddressBook" as VersionedAddressBook MODEL_COLOR
participant ":VersionedSscBook" as VersionedSscBook MODEL_COLOR
end box
[-> LogicManager : execute(undo)
activate LogicManager

LogicManager -> AddressBookParser : parseCommand(undo)
activate AddressBookParser
LogicManager -> ModuLightParser : parseCommand(undo)
activate ModuLightParser

create UndoCommand
AddressBookParser -> UndoCommand
ModuLightParser -> UndoCommand
activate UndoCommand

UndoCommand --> AddressBookParser
UndoCommand --> ModuLightParser
deactivate UndoCommand

AddressBookParser --> LogicManager : u
deactivate AddressBookParser
ModuLightParser --> LogicManager : u
deactivate ModuLightParser

LogicManager -> UndoCommand : execute()
activate UndoCommand

UndoCommand -> Model : undoAddressBook()
UndoCommand -> Model : undoSscBook()
activate Model

Model -> VersionedAddressBook : undo()
activate VersionedAddressBook
Model -> VersionedSscBook : undo()
activate VersionedSscBook

VersionedAddressBook -> VersionedAddressBook :resetData(ReadOnlyAddressBook)
VersionedAddressBook --> Model :
deactivate VersionedAddressBook
VersionedSscBook -> VersionedSscBook :resetData(ReadOnlySscBook)
VersionedSscBook --> Model :
deactivate VersionedSscBook

Model --> UndoCommand
deactivate Model
Expand Down
Binary file added docs/images/Ui_initial.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 added docs/images/Ui_navigate.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 added docs/images/addStu_ui.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 added docs/images/autoGrade_ui.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 added docs/images/deleteStu_ui.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 added docs/images/download_page.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 added docs/images/editStu_ui.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 added docs/images/findStu_ui.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 added docs/images/initial_Ui.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 added docs/images/sortStu_ui.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 added docs/images/stats_ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![CI Status](https://github.com/AY2324S1-CS2103T-W08-2/tp/workflows/Java%20CI/badge.svg)](https://github.com/AY2324S1-CS2103T-W08-2/tp/actions)
[![codecov](https://codecov.io/gh/AY2324S1-CS2103T-W08-2/tp/graph/badge.svg?token=DAJLBHDPYQ)](https://codecov.io/gh/AY2324S1-CS2103T-W08-2/tp)

![Ui](images/Ui_overview.png)
![Ui](images/Ui_navigate.png)

**AModuLight is a desktop student grades system application.** While it has a GUI, most of the user interactions happen using a CLI (Command Line Interface).

Expand Down
65 changes: 61 additions & 4 deletions docs/team/feifeiraindrops.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,82 @@ title: "Yufei Sun's Project Portfolio Page"


* **New Feature**: `addStu` - Add a student to the database

* **What is does**: Adds a student to the database. An empty score of the student will be added to all existing
graded components as well. It requires the student name, student id, and email, while the tutorial group and tag are optional.
* **Justification**: A student might be added after the graded components are set up, thus it is necessary to add
scores to graded components. Furthermore, a tutorial group is optional as it might be undetermined at the start of the semester.
* **Highlights**: Implementing this feature requires the creation of new classes such as tutorial groups and student id.
It requires a good understanding to make sure that they only accept the correct inputs.


* **New Feature**: `editStu` - edit the student information
* **What is does**: Edit a student's name, student id, email, tutorial group or tag, as indicated by the index. All student scores related to this student wil be updated as well.
* **Justification**: There might be changes to a student's information.
* **Highlights**: Implementing this feature requires a good understanding of the project model. Since a student score is related to a student, it has to be updated when the student is edited.


* **New Feature**: `deleteStu` - delete a student and related student scores from the database
* **What is does**: Delete a student as all related student scores as indicated by the index.
* **Justification**: A student can drop the module.
* **Highlights**: Implementing this feature requires a good understanding of the project model. Since a student score is related to a student, it should be removed when the student no longer exists.


* **New Feature**: `findStu` - find a student based on the keywords
* **What is does**: Find a student in the database based on the name, student id, tutorial group, email or tag keywords.
All student scores related to the student will be displayed as well. All graded components are displayed as they are all relevant.
* **Justification**: The user might be interested to find the students with one or many attributes. Allowing search
by attributes increases the flexibility of the search. Since student score is related to students, they are also displayed so that the user does not need rto do another search for them.
* **Highlights**: Implementing this feature requires a good design of the algorithm and understanding or the project models to show the correct student and student scores.


* **New Feature**: `findScore` - find a student score based on the keywords
* **What is does**: Find a student score in the database based on graded component name, student name, student id, tutorial group, email or tag keywords.
The student and graded component list will be emptied.
* **Justification**: A student score is related to one graded component and one student, thus it can ab found by keywords of both classes.
We assume that the user is only interested in the particular student scores when using this command. If they are interested in the students and graded components as well, findStu or findComp should be used instead.
* **Highlights**: Implementing this feature requires a good design of the algorithm and understanding or the project models to show the correct student scores.


* **New Feature**: `findComp` - find a graded component based on the keywords
* **What is does**: Find a graded component in the database based on component name. All students are displayed as they are all relevant.
All student scores related to the component will be displayed as well.
* **Justification**: Since student score is related to students, they are also displayed so that the user does not need rto do another search for them.
* **Highlights**: Implementing this feature requires a good design of the algorithm and understanding or the project models to show the correct graded components.

* **New Feature**: `listAll` - list all students, student scores and graded components
* **What is does**: Displays all students, student scores and graded components in the respective lists
* **Justification**: This feature is useful in resetting the display after a find command



* **Code contributed**:
* Highlights: designed and implemented tutorial group and student id classes, which are unique to the project
* [RepoSense link](https://nus-cs2103-ay2324s1.github.io/tp-dashboard/?search=&sort=groupTitle&sortWithin=title&timeframe=commit&mergegroup=&groupSelect=groupByRepos&breakdown=true&checkedFileTypes=docs~functional-code~test-code&since=2023-09-22&tabOpen=true&tabType=authorship&tabAuthor=feifeiraindrops&tabRepo=AY2324S1-CS2103T-W08-2%2Ftp%5Bmaster%5D&authorshipIsMergeGroup=false&authorshipFileTypes=docs~functional-code~test-code&authorshipIsBinaryFileTypeChecked=false&authorshipIsIgnoredFilesChecked=false)


* **Project management**:

* **Enhancements to existing features**:
* Setting up team repository, website and relevant tools to be used
* Setting up zoom for weekly meeting


* **Documentation**:
* User Guide:
* Documented the CRUD features and find features
* Organised and formatted the content
* Added comprehensive UI demonstration

* Developer Guide:
* Documented implementation of the logic component
* Updated UML diagrams for proposed implementation and better oop


* **Testing**:
* Implemented testing for models, commands and parsers related to student CRUD features and the find features.


* **Community**:
* Reviewed 11 PRs
* 1 with non-trivial comment


* **Tools**:

4 changes: 2 additions & 2 deletions src/main/java/seedu/modulight/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private Model initModelManager(Storage storage, ReadOnlyUserPrefs userPrefs) {
Optional<ReadOnlyStudentBook> studentBookOptional;
Optional<ReadOnlyStudentScoreBook> studentScoreBookOptional;
Optional<ReadOnlyGradedComponentBook> gradedComponentBookOptional;
ReadOnlyStudentBook initialStudentData = new StudentBook();
ReadOnlyStudentBook initialStudentData;
ReadOnlyStudentScoreBook initialStudentScoreData;
ReadOnlyGradedComponentBook initialGradedComponentData;
try {
Expand All @@ -128,7 +128,7 @@ private Model initModelManager(Storage storage, ReadOnlyUserPrefs userPrefs) {
.orElseGet(SampleGcDataUtil::getSampleGcBook);
checkBookValidity(initialStudentData, initialGradedComponentData, initialStudentScoreData);

} catch (DataLoadingException e) {
} catch (DataLoadingException | RuntimeException e) {
logger.warning("Data file at " + storage.getStudentBookFilePath() + " could not be loaded."
+ " Will be starting with an empty AddressBook.");
initialStudentData = new StudentBook();
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/seedu/modulight/logic/commands/AutoGradeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import javafx.collections.ObservableList;
import seedu.modulight.commons.core.index.Index;
import seedu.modulight.commons.util.ToStringBuilder;
import seedu.modulight.logic.commands.exceptions.CommandException;
import seedu.modulight.model.Model;
import seedu.modulight.model.student.Student;
Expand Down Expand Up @@ -146,4 +147,28 @@ private void addGradeToAllStudent(Model model) throws CommandException {
}

}

@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}

// instanceof handles nulls
if (!(other instanceof AutoGradeCommand)) {
return false;
}

AutoGradeCommand otherEditCommand = (AutoGradeCommand) other;
return Arrays.equals(passingGradeValue, otherEditCommand.passingGradeValue)
&& autoGradeType.equals(otherEditCommand.autoGradeType);
}

@Override
public String toString() {
return new ToStringBuilder(this)
.add("autoGrade type", autoGradeType)
.add("gradeThreshold", Arrays.toString(gradeThreshold))
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public CommandResult execute(Model model) throws CommandException {
for (int i = studentScoreList.size() - 1; i >= 0; i--) {
StudentScore curScore = studentScoreList.get(i);
if (curScore.getStudentId().equals(studentToDelete.getStudentId())) {
// somewhat inefficient, to change
GradedComponent gc = gradedComponentBook.getGradedComponentByName(curScore.getGcName());
gc.deleteScore(curScore);
gradedComponentBook.setGradedComponent(gc, gc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,4 @@ public String toString() {
.add("targetIndex", targetIndex)
.toString();
}


}
Loading

0 comments on commit ab8e4be

Please sign in to comment.