Skip to content

Commit

Permalink
Merge pull request #236 from nguyiyang/bugfix
Browse files Browse the repository at this point in the history
Fix bugs and update documentation
  • Loading branch information
juliussneezer04 authored Nov 7, 2021
2 parents f31fcd0 + 5be9bd8 commit 1c44b9d
Show file tree
Hide file tree
Showing 34 changed files with 304 additions and 196 deletions.
102 changes: 84 additions & 18 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ Step 2: The user deletes TutorialClass G08 using the `deletec` command. The `del
of TutorialClass `G08` to `G00`.

### Tutorial Group Management Features
This feature is split into two parts.
This feature is split into two parts.
* Adding/removing tutorial group to tutorial class (Contributed by Ngu Yi Yang)
* Adding/removing student to tutorial group. (Contributed by Zhou Yirui)

Expand All @@ -355,25 +355,25 @@ ClassMATE allows the user to manage information relevant to the TutorialGroup. A
#### Current Implementation (Adding/removing tutorial group to tutorial class)

The class `Classmate` facilitates all operations related to tutorial groups. It maintains a
`UniqueTutorialClassList` containing all tutorial classes, where each class maintains a `UniqueTutorialGroupList` containing its tutorial classes.
`UniqueTutorialClassList` containing all tutorial classes, where each class maintains a `UniqueTutorialGroupList` containing its tutorial groups.
Tutorial groups are identical only if all its attributes, `GroupName`, `ClassCode` and `GroupType` are the same.
The `Classmate` contains a summary of all the logic of the interaction between tutorial group and tutorial class
adding tutorial groups to tutorial classes (e.g. `AddGroupCommand`) executed on the `UniqueTutorialGroupList`, and adding students to tutorial groups.
`Classmate` contains a summary of all the logic of the interaction between tutorial group and tutorial class such as
adding tutorial groups to tutorial classes (e.g. `AddGroupCommand`) executed on the `UniqueTutorialGroupList`.

The following operations are implemented:
* `Classmate#hasTutorialGroup(TutorialGroup tutorialGroup)` - Checks if tutorial group is in ClassMATE
* `Classmate#addTutorialGroup(TutorialGroup tutorialGroup)` - Adds tutorial group to ClassMATE
* `Classmate#removeTutorialGroup(TutorialGroup tutorialGroup)` - Deletes existing tutorial group from ClassMATE
* `UniqueTutorialClassList#contains(TutorialGroup toCheck)` - Checks if tutorial group is in any of the tutorial classes
* `UniqueTutorialClassList#add(TutorialGroup toAdd)` - Adds tutorial group to its respective class
* `TutorialClass#getTutorialGroups()` - Retrieves the list of tutorial groups within the TutorialClass
* `TutorialClass#createTestTutorialClass(ClassCode classCode)` - Creates a dummy tutorial class from the class code of the tutorial group for checking
* `UniqueTutorialClassList#contains(TutorialGroup toCheck)` - Checks if tutorial group is in any of the tutorial classes
* `UniqueTutorialClassList#add(TutorialGroup toAdd)` - Adds tutorial group to its respective class
* `TutorialClass#getTutorialGroups()` - Retrieves the list of tutorial groups within the TutorialClass
* `TutorialClass#createTestTutorialClass(ClassCode classCode)` - Creates a dummy tutorial class from the class code of the tutorial group for checking

Given below is an example of how the tutorial group features can be used:

Step 1. The user executes an `addcg gn/1 c/G06 type/OP1` command. The `addcg` command calls `Model#hasTutorialClass()`,
and the model component checks if the TutorialClass specified by the class code exists, then checks whether the tutorial group already exists
using `Model#hasTutorialGroup()`and calls `Model#addTutorialGroup()` if it does not.
and the model component checks if the TutorialClass specified by the class code exists and throws an exception if it does not.
It then checks whether the tutorial group already exists using `Model#hasTutorialGroup()`and calls `Model#addTutorialGroup()` if it does not.

The checking of whether the tutorial class and tutorial group already exists is done as such:
`Classmate` calls the `contains` method of its `UniqueTutorialClassList`. This method is overloaded to accept
Expand All @@ -383,8 +383,8 @@ to retrieve the tutorial class of the tutorial group it is being added to, so th
within the `UniqueTutorialClassList` and get its `UniqueTutorialGroupList` using the method `TutorialClass#getTutorialGroups()`
and from there check whether the tutorial group already exists or not.

Adding of tutorial groups is similar to the checking part in that a tutorial class is created for checking and
retrieve that tutorial class from the `UniqueTutorialClassList` to add that tutorial group into its `UniqueTutorialGroupList`.
Adding of tutorial groups is similar; It again finds the tutorial class in the `UniqueTutorialClassList` using its class code
After retrieving the respective tutorial class, it can then add the tutorial group using `UniqueTutorialClassList#add(TutorialGroup toAdd)`.

This modifies and saves the state of ClassMATE.

Expand All @@ -398,19 +398,28 @@ During the parsing, a new TutorialGroup instance is created. This `TutorialGroup
The *Sequence Diagram* below summarizes the aforementioned steps.

![AddGroupSequenceDiagram](images/AddGroupSequenceDiagram.png)
![GetTutorialGroupsDiagram](images/GetTutorialGroupsDiagram.png)

#### Design Considerations

#### Aspect: Storing Tutorial Groups as lists
* Alternative 1 (current choice): Storing tutorial groups in their respective tutorial classes
* Pros: Faster when performing find functions and groups are better organised.
* Pros: Faster when performing find functions such as finding tutorial groups in a particular class. Tutorials groups are also better organised.
* Cons: Splitting groups based on a category makes it harder to extend to support filtering groups with a different category from what is implemented.

* Alternative 2: Use a single list to store all tutorial groups.
* Pros: Simpler to implement, without the use of multiple lists to store tutorial groups of different types ("OP1" or "OP2").
* Pros: Simpler to implement, easier to add or remove tutorial groups.
Storing tutorial groups as arrays in JSON is less complicated.
* Cons: Searching or filtering the list of tutorial groups by group types may take a longer time.


### Recommended workflow for setting up ClassMATE

The *Activity Diagram* below provides an example of how users should set up their tutorial classes, tutorial groups and students
in ClassMATE.

![SetUpActivityDiagram](images/SetUpActivityDiagram.png)


--------------------------------------------------------------------------------------------------------------------

## **Documentation, logging, testing, configuration, dev-ops**
Expand Down Expand Up @@ -452,7 +461,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
| `* * ` | user | add a class schedule | plan my week in advance |
| `* * *` | user | view a class' details | easily check the details of a particular class |
| `* * *` | user | delete a student | remove entries that I no longer need |
| `* * *` | user | delete a class | remove classes that I no longer need |
| `* * *` | user | delete a class | remove classes that I no longer need
| `* * *` | user | find a student by name | locate details of students without having to go through the entire list |
| `* * *` | user | find a class by code | locate details of a class without having to go through the entire list |
| `* * *` | user | view all classes | see which classes I'm taking |
Expand Down Expand Up @@ -490,6 +499,35 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli

Use case resumes at step 2.

**Use case: Edit a student**

**MSS**

1. User requests to list students
2. ClassMATE shows a list of students
3. User requests to edit a specific student in the list with some parameters
4. ClassMATE edits the student

Use case ends.

**Extensions**

* 2a. The list is empty.

Use case ends.

* 3a. The given index is invalid.

* 3a1. ClassMATE shows an error message.

Use case resumes at step 2.

* 3b. The given parameter to edit is a Class Code.

* 3b1. ClassMATE removes all existing tutorial groups of the student.

Use case resumes at step 4.

**Use case: List students**

**MSS**
Expand Down Expand Up @@ -551,6 +589,34 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli

Use case resumes at step 2.

**Use case: Add a tutorial group**

**MSS**

1. User requests to add a tutorial group with the given parameters, Group number, Group type and Class code.
2. ClassMATE adds the tutorial class.

Use case ends.

**Extensions**

* 1a. ClassMATE detects an invalid parameter.
* 1a1. ClassMATE shows a message informing the user.

Use case ends.


* 1b. The tutorial class that the tutorial group is being added to does not exists.
* 1b1. ClassMATE shows a message informing the user.

Use case ends.


* 1c. The tutorial group already exists.
* 1c1. ClassMATE shows a message informing the user.

Use case ends.

**Use case: Delete Latest Mark from Student**

**MSS**
Expand Down Expand Up @@ -603,8 +669,8 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
* **Private student detail**: A student detail that is not meant to be shared with others
* **Tutorial class**: A CS2101 tutorial class. Each student can only have up to one tutorial class
* **Student**: An NUS student taking the CS2101(T) module
* **Group**: A group is a subsection of the class and contains a few students for the purpose of small activities or group project
* **Group name**: The name of a group in the CS2101 class, which is specified by a number.
* **Tutorial group**: A tutorial group is a subsection of the class and contains a few students for the purpose of small activities or group project.
* **Group number**: The number of a group in the CS2101 class, which is specified by a number.
* **Class code**: The name of a typical class in for the CS2101 module. E.g. G06.
* **Group type**: The type of a group in the CS2101 class, which is either OP1 or OP2.

Expand Down
16 changes: 8 additions & 8 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ We hope you find this User Guide helpful in using ClassMATE!
1. Copy the file to the folder you want to use as the _home folder_ for your ClassMATE.
1. Double-click the file to start the app. The GUI similar to the below should appear in a few seconds. Note how the app contains some sample data.<br>
![Ui](images/Ui-annotated.png)
1. Type the command in the **Command-Line Input** and press Enter to execute it. e.g. typing **`help`** and pressing Enter will open the help window.
1. Type the command in the **Command-Line Input** and press Enter to execute it. e.g. typing **`help`** and pressing Enter will open the help window.
Check out some examples in the [Tutorial](#CLI Tutorial)
1. Refer to the [Features](#Features) below for details of each command.

Expand Down Expand Up @@ -222,7 +222,7 @@ Examples:

## Student Commands

This part of the guide covers all the commands you can use to manage student information!
This part of the guide covers all the commands you can use to manage student information!

These features include the ability to:
1. Add new students
Expand Down Expand Up @@ -394,7 +394,7 @@ Examples:

## Tutorial Class Commands

This section covers all the commands you can use to manage information pertaining to tutorial classes!
This section covers all the commands you can use to manage information pertaining to tutorial classes!

Features include the ability to:
1. Add a tutorial class
Expand Down Expand Up @@ -510,7 +510,7 @@ Entering format: `addcg gn/GROUP_NUMBER c/CLASS_CODE type/GROUP_TYPE`

* The class must have already been added to ClassMATE first. If you are unsure, you can refer to
[Adding a Tutorial Class](#adding-a-tutorial-class)

* Tutorial groups are identified by GROUP_NUMBER, GROUP_TYPE and CLASS_CODE. This means that
any two tutorial groups are identical if all three fields are identical, which is not allowed.

Expand Down Expand Up @@ -581,8 +581,8 @@ Only `OP1` and `OP2` are accepted as Group Types.


Example:
* `liststu`shows that Betsy is a student in class G06 with Index 1.
`deletesg 1 g/A c/G06 type/OP1` then removes Betsy from OP1 Group A in class G06
* `liststu c/G06`shows that Betsy is a student in class G06 with Index 1.
`deletesg 1 gn/1 c/G06 type/OP1` then removes Betsy from OP1 Group 1 in class G06

### Clearing all data : `clear`

Expand Down Expand Up @@ -628,8 +628,8 @@ If your changes to the data file makes its format invalid, ClassMATE will discar
Action | Format, Examples
--------|------------------
**Help** | `help`
**Add student** | `addstu n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS c/CLASS_CODE [t/TAG]…​`<br> e.g., `addstu n/James Ho p/22224444 e/[email protected] a/123, Clementi Rd, 1234665 c/G01 t/attentive`
**Edit student** | `editstu INDEX [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [c/CLASS_CODE] [t/TAG]…​`<br> e.g., `editstu 2 n/James Lee e/[email protected]`
**Add student** | `addstu n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS c/CLASS_CODE [t/TAG]…​`<br> e.g., `addstu n/James Ho p/22224444 e/[email protected] a/123, Clementi Rd, 1234665 c/G01 t/attentive`
**Edit student** | `editstu INDEX [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [c/CLASS_CODE] [t/TAG]…​`<br> e.g., `editstu 2 n/James Lee e/[email protected]`
**View student** | `viewstu INDEX`<br> e.g., `liststu` followed by `viewstu 2`
**Find student** | `findstu KEYWORD [MORE_KEYWORDS]`<br> e.g., `findstu John`
**Delete student** | `deletestu INDEX`<br> e.g., `liststu` followed by `deletestu 3`
Expand Down
Binary file modified docs/diagrams/AddGroupSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
121 changes: 19 additions & 102 deletions docs/diagrams/AddGroupSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -1,130 +1,47 @@
@startuml
!include style.puml

box Logic LOGIC_COLOR_T1
participant AddGroupCommand as AddGroupCommand LOGIC_COLOR
participant "**r:CommandResult**" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant "**model:ModelManager**" as ModelManager MODEL_COLOR
participant "**classmate:Classmate**" as Classmate MODEL_COLOR
participant "**tutorialClasses:UniqueTutorialClassList**" as UniqueTutorialClassList MODEL_COLOR
participant TutorialClass as TutorialClass MODEL_COLOR
participant UniqueTutorialGroupList as UniqueTutorialGroupList MODEL_COLOR
participant "**:UniqueTutorialClassList**" as UniqueTutorialClassList MODEL_COLOR
participant "<<class>>\n**TutorialClass**" as StaticTutorialClass MODEL_COLOR
participant ":**TutorialClass**" as TutorialClass MODEL_COLOR
participant ":**UniqueTutorialGroupList**" as UniqueTutorialGroupList MODEL_COLOR
end box

[-> AddGroupCommand : ""execute(m)""
activate AddGroupCommand

AddGroupCommand -> ModelManager : ""hasTutorialClass(tc)""
activate ModelManager

ModelManager -> Classmate : ""hasTutorialClass(tc)""
activate Classmate

Classmate -> UniqueTutorialClassList : ""contains(tc)""
activate UniqueTutorialClassList

UniqueTutorialClassList -> TutorialClass : ""check through tutorial class list""
activate TutorialClass

[-> UniqueTutorialClassList : ""contains(tc)""

note right
""tc"" is the TutorialClass
that is to be added
to ClassMate
that the TutorialGroup
being added to ClassMate
belongs to
end note

TutorialClass --> UniqueTutorialClassList
deactivate TutorialClass

UniqueTutorialClassList --> Classmate
deactivate UniqueTutorialClassList

Classmate --> ModelManager
deactivate Classmate

ModelManager --> AddGroupCommand
deactivate

AddGroupCommand -> ModelManager : ""hasTutorialGroup(tg)""
activate ModelManager

ModelManager -> Classmate : ""hasTutorialGroup(tg)""
activate Classmate

Classmate -> UniqueTutorialClassList : ""contains(tg)""
activate UniqueTutorialClassList

UniqueTutorialClassList -> TutorialClass : ""getClassCode(tg)""
activate TutorialClass
UniqueTutorialClassList -> TutorialClass : ""createTestTutorialClass(tc)""
UniqueTutorialClassList -> TutorialClass : ""check for matching tutorial class""
UniqueTutorialClassList -> TutorialClass : ""getTutorialGroups()""

TutorialClass --> UniqueTutorialClassList
deactivate TutorialClass
[-> UniqueTutorialClassList : ""contains(tg)""

ref over UniqueTutorialClassList, StaticTutorialClass, TutorialClass
get tutorial groups
end ref

UniqueTutorialClassList -> UniqueTutorialGroupList : ""check if tutorial group exists""
UniqueTutorialClassList -> UniqueTutorialGroupList : ""contains(tg)""
activate UniqueTutorialGroupList

UniqueTutorialGroupList --> UniqueTutorialClassList
deactivate UniqueTutorialGroupList

UniqueTutorialClassList --> Classmate
deactivate UniqueTutorialClassList
[-> UniqueTutorialClassList : ""add(tg)""

Classmate --> ModelManager
deactivate Classmate
ref over UniqueTutorialClassList, StaticTutorialClass, TutorialClass
get tutorial groups
end ref

ModelManager --> AddGroupCommand
deactivate

AddGroupCommand -> ModelManager : ""addTutorialGroup(tc)""
activate ModelManager

ModelManager -> Classmate : ""addTutorialGroup(tc)""
activate Classmate

Classmate -> UniqueTutorialClassList : ""add(tg)""
activate UniqueTutorialClassList

UniqueTutorialClassList -> TutorialClass : ""getClassCode(tg)""
activate TutorialClass
UniqueTutorialClassList -> TutorialClass : ""createTestTutorialClass(tc)""
UniqueTutorialClassList -> TutorialClass : ""check for matching tutorial class""
UniqueTutorialClassList -> TutorialClass : ""getTutorialGroups()""

TutorialClass --> UniqueTutorialClassList
deactivate TutorialClass

UniqueTutorialClassList -> UniqueTutorialGroupList : ""add tutorial group""
UniqueTutorialClassList -> UniqueTutorialGroupList : ""add(tg))""
activate UniqueTutorialGroupList

UniqueTutorialGroupList --> UniqueTutorialClassList
deactivate UniqueTutorialGroupList

UniqueTutorialClassList --> Classmate
deactivate UniqueTutorialClassList

Classmate --> ModelManager
deactivate Classmate

ModelManager --> AddGroupCommand
deactivate

create CommandResult
AddGroupCommand -> CommandResult
activate CommandResult

CommandResult --> AddGroupCommand : ""r""
deactivate CommandResult

[<-- AddGroupCommand : ""r""
deactivate AddGroupCommand

AddGroupCommand -[hidden]> CommandResult
destroy AddGroupCommand

@enduml
Loading

0 comments on commit 1c44b9d

Please sign in to comment.