Skip to content

Commit

Permalink
Merge pull request #100 from hogantan/branch-UpdateDG
Browse files Browse the repository at this point in the history
Update DG (Add Command)
  • Loading branch information
hogantan authored Oct 24, 2020
2 parents 1e359f3 + 13c2666 commit 5bcf29d
Show file tree
Hide file tree
Showing 37 changed files with 251 additions and 190 deletions.
65 changes: 53 additions & 12 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
---
layout: page
title: Developer Guide
Reeve - Developer Guide
---
* Table of Contents
{:toc}

--------------------------------------------------------------------------------------------------------------------
## Introduction
Welcome to Reeve!

Reeve is an integrated platform specifically catered to Primary, Secondary and Tertiary education private tutors to better manage their students' individual needs.
It contains students' particulars, administrative and academic details.

Reeve is optimized for users that are very comfortable with typing as it works on a Command Line Interface (CLI).

Students' details are displayed in a neat and organized manner through the use of a Graphical User Interface (GUI).

## **Setting up, getting started**
If you are looking for an application to better allow you to track your students' administrative and academic details so that you can better meet their needs? Look no further!

## 1. About

## 2. Understanding the Guide

## 3. **Getting started**

Refer to the guide [_Setting up and getting started_](SettingUp.md).

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

## **Design**
## 4. **Design**

### Architecture
### 4.1 Architecture

<img src="images/ArchitectureDiagram.png" width="450" />

Expand Down Expand Up @@ -57,7 +70,7 @@ The *Sequence Diagram* below shows how the components interact with each other f

The sections below give more details of each component.

### UI component
### 4.2 UI component

![Structure of the UI Component](images/UiClassDiagram.png)

Expand All @@ -73,7 +86,7 @@ The `UI` component,
* Executes user commands using the `Logic` component.
* Listens for changes to `Model` data so that the UI can be updated with the modified data.

### Logic component
### 4.3 Logic component

![Structure of the Logic Component](images/LogicClassDiagram.png)

Expand All @@ -93,7 +106,7 @@ Given below is the Sequence Diagram for interactions within the `Logic` componen
<div markdown="span" class="alert alert-info">:information_source: **Note:** The lifeline for `DeleteCommandParser` should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram.
</div>

### Model component
### 4.4 Model component

![Structure of the Model Component](images/ModelClassDiagram.png)

Expand All @@ -113,7 +126,7 @@ The `Model`,
</div>


### Storage component
### 4.5 Storage component

![Structure of the Storage Component](images/StorageClassDiagram.png)

Expand All @@ -123,16 +136,44 @@ The `Storage` component,
* can save `UserPref` objects in json format and read it back.
* can save the address book data in json format and read it back.

### Common classes
### 4.6 Common classes

Classes used by multiple components are in the `seedu.addressbook.commons` package.

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

## **Implementation**
## 5. **Implementation**

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

### 5.1 Student administrative details features

The student administrative details feature keeps track of essential administrative student details. The feature comprises of the following commands,
* `AddCommand` - Adds a student into the student list
* `EditCommand` - Edits the details of a particular student
* `DeleteCommand` - Deletes a particular student
* `FindCommand` - Finds students matching certain parameters
* `OverdueCommand` - Finds students who have overdue payments
* `ClearCommand` - Deletes all students in the student list

#### 5.1.1 Add Student Command

The following describes the flow of how `AddCommand` is performed.

1. Upon successfully parsing the user input, the `AddCommand#execute(Model model)` is called which checks whether
the added student already exists in the `UniqueStudentList`.
2. A unique student is defined by `Name`, `Phone`, `School` and `Year`. If a duplicate student is defined,
a `CommandException` is thrown and the student will not be added.
3. If the added student is not a duplicate, then the `Model#addStudent(Student student)` is called to add the student.
A new `CommandResult` is returned with a success message and the added student.
4. The student is be added into `UniqueStudentList` and a success message is shown in the result display.

The following activity diagram summarizes the flow of events when the `AddCommand` is being executed:

![Flow of Add Student Command](images/AddStudentActivityDiagram.png)

Figure ___. Activity Diagram for AddStudentCommand

### 5.2 Student questions features

The student questions feature keeps track of questions raised by a student to his tutor. The features comprises of the following commands:
Expand Down
17 changes: 17 additions & 0 deletions docs/diagrams/AddStudentActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@startuml
start
:User executes add student command;
:Parses the command;
if () then ([command is valid])
:Add command is executed;
if() then ([student already exists])
:Display duplicate student error message;
else ([student is unique])
:Add student into student list;
:Display add student success message;
endif
else ([command is invalid - missing or invalid arguments])
:Display parse error message;
endif
stop
@enduml
Binary file added docs/images/AddStudentActivityDiagram.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 src/main/java/seedu/address/logic/LogicManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public ReadOnlyReeve getAddressBook() {

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

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import static java.util.Objects.requireNonNull;
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DETAIL_TEXT;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_STUDENTS;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -58,7 +58,7 @@ public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);
logger.log(Level.INFO, "Beginning command execution");

List<Student> lastShownList = model.getFilteredPersonList();
List<Student> lastShownList = model.getFilteredStudentList();
if (index.getZeroBased() >= lastShownList.size()) {
logger.log(Level.WARNING, "Invalid student index input error");
throw new CommandException(Messages.MESSAGE_INVALID_STUDENT_DISPLAYED_INDEX);
Expand All @@ -71,8 +71,8 @@ public CommandResult execute(Model model) throws CommandException {

Student updatedStudent = super.updateStudentDetail(studentToAddDetail, details);

model.setPerson(studentToAddDetail, updatedStudent);
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
model.setStudent(studentToAddDetail, updatedStudent);
model.updateFilteredStudentList(PREDICATE_SHOW_ALL_STUDENTS);
logger.log(Level.INFO, "Execution complete");
return new CommandResult(String.format(MESSAGE_SUCCESS, updatedStudent.getName(), detailToAdd));
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/logic/commands/AddCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ public AddCommand(Student student) {
public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);

if (model.hasPerson(toAdd)) {
if (model.hasStudent(toAdd)) {
throw new CommandException(MESSAGE_DUPLICATE_STUDENT);
}

model.addPerson(toAdd);
model.addStudent(toAdd);
return new CommandResult(String.format(MESSAGE_SUCCESS, toAdd));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static java.util.Objects.requireNonNull;
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_STUDENTS;

import java.util.List;
import java.util.logging.Level;
Expand Down Expand Up @@ -45,7 +45,7 @@ public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);
logger.log(Level.INFO, "Beginning command execution");

List<Student> lastShownList = model.getFilteredPersonList();
List<Student> lastShownList = model.getFilteredStudentList();
if (index.getZeroBased() >= lastShownList.size()) {
logger.log(Level.WARNING, "Handling non-existent student error");
throw new CommandException(Messages.MESSAGE_INVALID_STUDENT_DISPLAYED_INDEX);
Expand All @@ -58,8 +58,8 @@ public CommandResult execute(Model model) throws CommandException {
}

Student replacement = asker.addQuestion(questionToAdd);
model.setPerson(asker, replacement);
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
model.setStudent(asker, replacement);
model.updateFilteredStudentList(PREDICATE_SHOW_ALL_STUDENTS);
logger.log(Level.INFO, "Execution complete");
return new CommandResult(String.format(MESSAGE_SUCCESS, replacement.getName(), questionToAdd));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import static java.util.Objects.requireNonNull;
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DETAIL_INDEX;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_STUDENTS;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -60,7 +60,7 @@ public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);
logger.log(Level.INFO, "Beginning command execution");

List<Student> lastShownList = model.getFilteredPersonList();
List<Student> lastShownList = model.getFilteredStudentList();
if (studentIndex.getZeroBased() >= lastShownList.size()) {
logger.log(Level.WARNING, "Invalid student index input error");
throw new CommandException(Messages.MESSAGE_INVALID_STUDENT_DISPLAYED_INDEX);
Expand All @@ -77,8 +77,8 @@ public CommandResult execute(Model model) throws CommandException {

Student updatedStudent = super.updateStudentDetail(studentToAddDetail, details);

model.setPerson(studentToAddDetail, updatedStudent);
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
model.setStudent(studentToAddDetail, updatedStudent);
model.updateFilteredStudentList(PREDICATE_SHOW_ALL_STUDENTS);
logger.log(Level.INFO, "Execution complete");
return new CommandResult(String.format(MESSAGE_SUCCESS, updatedStudent.getName(), removedDetail));
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/logic/commands/DeleteCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ public DeleteCommand(Index targetIndex) {
@Override
public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);
List<Student> lastShownList = model.getFilteredPersonList();
List<Student> lastShownList = model.getFilteredStudentList();

if (targetIndex.getZeroBased() >= lastShownList.size()) {
throw new CommandException(Messages.MESSAGE_INVALID_STUDENT_DISPLAYED_INDEX);
}

Student studentToDelete = lastShownList.get(targetIndex.getZeroBased());
model.deletePerson(studentToDelete);
model.deleteStudent(studentToDelete);
return new CommandResult(String.format(MESSAGE_DELETE_STUDENT_SUCCESS, studentToDelete));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import static java.util.Objects.requireNonNull;
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_STUDENTS;

import java.util.List;
import java.util.logging.Level;
Expand Down Expand Up @@ -43,7 +43,7 @@ public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);
logger.log(Level.INFO, "Beginning command execution");

List<Student> lastShownList = model.getFilteredPersonList();
List<Student> lastShownList = model.getFilteredStudentList();
if (studentIndex.getZeroBased() >= lastShownList.size()) {
logger.log(Level.WARNING, "Handling non-existent student error");
throw new CommandException(Messages.MESSAGE_INVALID_STUDENT_DISPLAYED_INDEX);
Expand All @@ -58,8 +58,8 @@ public CommandResult execute(Model model) throws CommandException {
Question deleted = asker.getQuestions().get(questionIndex.getZeroBased());
Student replacement = asker.deleteQuestion(deleted);

model.setPerson(asker, replacement);
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
model.setStudent(asker, replacement);
model.updateFilteredStudentList(PREDICATE_SHOW_ALL_STUDENTS);
logger.log(Level.INFO, "Execution complete");
return new CommandResult(String.format(MESSAGE_SUCCESS, replacement.getName(), deleted));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DETAIL_INDEX;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DETAIL_TEXT;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_STUDENTS;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -66,7 +66,7 @@ public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);
logger.log(Level.INFO, "Beginning command execution");

List<Student> lastShownList = model.getFilteredPersonList();
List<Student> lastShownList = model.getFilteredStudentList();
if (studentIndex.getZeroBased() >= lastShownList.size()) {
logger.log(Level.WARNING, "Invalid student index input error");
throw new CommandException(Messages.MESSAGE_INVALID_STUDENT_DISPLAYED_INDEX);
Expand All @@ -84,8 +84,8 @@ public CommandResult execute(Model model) throws CommandException {

Student updatedStudent = super.updateStudentDetail(studentToAddDetail, details);

model.setPerson(studentToAddDetail, updatedStudent);
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
model.setStudent(studentToAddDetail, updatedStudent);
model.updateFilteredStudentList(PREDICATE_SHOW_ALL_STUDENTS);
logger.log(Level.INFO, "Execution complete");
return new CommandResult(String.format(MESSAGE_SUCCESS, updatedStudent.getName(), detailToAdd));
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/seedu/address/logic/commands/EditCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import static seedu.address.logic.parser.CliSyntax.PREFIX_TIME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_VENUE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_YEAR;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_STUDENTS;

import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -82,7 +82,7 @@ public EditCommand(Index index, EditStudentDescriptor editStudentDescriptor,
@Override
public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);
List<Student> lastShownList = model.getFilteredPersonList();
List<Student> lastShownList = model.getFilteredStudentList();

if (index.getZeroBased() >= lastShownList.size()) {
throw new CommandException(Messages.MESSAGE_INVALID_STUDENT_DISPLAYED_INDEX);
Expand All @@ -91,12 +91,12 @@ public CommandResult execute(Model model) throws CommandException {
Student studentToEdit = lastShownList.get(index.getZeroBased());
Student editedStudent = createEditedStudent(studentToEdit, editStudentDescriptor, editAdminDescriptor);

if (!studentToEdit.isSameStudent(editedStudent) && model.hasPerson(editedStudent)) {
if (!studentToEdit.isSameStudent(editedStudent) && model.hasStudent(editedStudent)) {
throw new CommandException(MESSAGE_DUPLICATE_PERSON);
}

model.setPerson(studentToEdit, editedStudent);
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
model.setStudent(studentToEdit, editedStudent);
model.updateFilteredStudentList(PREDICATE_SHOW_ALL_STUDENTS);
return new CommandResult(String.format(MESSAGE_EDIT_PERSON_SUCCESS, editedStudent));
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/logic/commands/FindCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ public CommandResult execute(Model model) {
for (Predicate <Student> currentPredicate : predicates) {
consolidatedPredicate = consolidatedPredicate.and(currentPredicate);
}
model.updateFilteredPersonList(consolidatedPredicate);
model.updateFilteredStudentList(consolidatedPredicate);
return new CommandResult(
String.format(Messages.MESSAGE_STUDENTS_LISTED_OVERVIEW, model.getFilteredPersonList().size()));
String.format(Messages.MESSAGE_STUDENTS_LISTED_OVERVIEW, model.getFilteredStudentList().size()));
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/logic/commands/ListCommand.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package seedu.address.logic.commands;

import static java.util.Objects.requireNonNull;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_STUDENTS;

import seedu.address.model.Model;

Expand All @@ -18,7 +18,7 @@ public class ListCommand extends Command {
@Override
public CommandResult execute(Model model) {
requireNonNull(model);
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
model.updateFilteredStudentList(PREDICATE_SHOW_ALL_STUDENTS);
return new CommandResult(MESSAGE_SUCCESS);
}
}
Loading

0 comments on commit 5bcf29d

Please sign in to comment.