Skip to content

Commit

Permalink
Merge pull request #255 from iMarbles/docs-DG
Browse files Browse the repository at this point in the history
DeveloperGuide.adoc: Updates
  • Loading branch information
Kratious committed Nov 12, 2018
2 parents a255abb + 065dd30 commit 70b5214
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 40 deletions.
62 changes: 46 additions & 16 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,10 @@ We are using `java.util.logging` package for logging. The `LogsCenter` class is
Certain properties of the application can be controlled (e.g App name, logging level) through the configuration file (default: `config.json`).

//tag::command-switch[]

[[Implementation-Switch]]
=== Switch command

The `switch` command is used to switch the context between 'volunteer' and 'event'.

===== Current implementation
Expand All @@ -445,19 +447,19 @@ The `switch` command updates the context found in `ModelManager` before raising

In addition to updating the context, the `switch` command also does the following:

* Clear all predicates for volunteer, events and record lists.
* Clears all predicates for volunteers, events and record lists.
* Resets the state pointer (for undo/redo functions).
* Raise a `ContextChangeEvent` to update the UI.

The figure below is the sequence diagram to show how the `switch` command works when switching from volunteer to event context.

.Simplified sequence diagram of switch command
image::command_switch_sd.png[switch SD, 800]
* Raises `ContextChangeEvent` to update the UI.

The following code snippet shows what the `switch` command does upon execution:
```Java
public class SwitchCommand extends Command {
//...
public SwitchCommand(String contextToSwitch) {
requireNonNull(contextToSwitch);
contextId = contextToSwitch;
}

@Override
public CommandResult execute(Model model, CommandHistory history) {
requireNonNull(model);
Expand All @@ -474,6 +476,22 @@ public class SwitchCommand extends Command {
}
```

From the code snippet above, we see that upon calling the `SwitchCommand`, a contextId is set.
The contextId (which is retrieved from the user's input) is either 'e' for event or 'v' for volunteers.
This contextId will be used when the execute method is called.

When the execute method is called, the context is set in the model via the 'setCurrentContext' method.
The model contains different methods to update the various lists. A predicate is passed to reset each of the lists to the initial state.

The model also resets the state pointer so that the `undo` and `redo` functions will point to a fresh, new state.

Lastly, the `EventsCenter` posts a new event so that the panels would update accordingly and display the relevant lists.

The figure below is the sequence diagram to show how the `switch` command works when switching from volunteer to event context.

.Simplified sequence diagram of switch command
image::command_switch_sd.png[switch SD, 800]

===== Design considerations
====== Aspect: How context is maintained
* **Alternative 1 (current choice):** Create a new `Context` class.
Expand Down Expand Up @@ -742,16 +760,11 @@ The `manage` command updates the context found in `ModelManager` through the `mo

In addition to updating the context, the `manage` command also does the following:

* Clear all predicates for volunteer list.
* Filter the existing records by the selected event.
* Clears all predicates for volunteer list.
* Filters the existing records by the selected event.
* Resets the state pointer (for undo/redo functions).
* Raise a `RecordChangeEvent` to set the selected event.
* Raise a `ContextChangeEvent` to update the UI.

The figure below is the sequence diagram to show how the `switch` command works when switching from volunteer to event context.

.Simplified sequence diagram for manage command
image::command_manage_sd.png[manage SD, 800]
* Raises `RecordChangeEvent` to set the selected event.
* Raises `ContextChangeEvent` to update the UI.

The following code snippet shows what the `manage` command does upon execution:

Expand Down Expand Up @@ -790,6 +803,23 @@ public class ManageCommand extends Command {
}
```

From the code snippet above, we see that the current state of event list from the model is stored into another list called 'filteredEventList'.
Storing the events in another list is done so that the list can be easily referenced in later parts of the code.

The volunteer list in the model is updated with the predicate so that it now contains the list of all volunteers in the system.

A quick check is done to ensure that the user input is valid. Otherwise, an exception is thrown.

If the user input is valid, the application changes to the record context. Then, the selected event by the user is stored in the model.
In addition, the model resets the state pointer so that the `undo` and `redo` functions will point to a fresh, new state.

Lastly, all the relevant UI is updated by posting events via the `EventsCenter`.

The figure below is the sequence diagram to show how the `switch` command works when switching from volunteer to event context.

.Simplified sequence diagram for manage command
image::command_manage_sd.png[manage SD, 800]

===== Design considerations
====== Aspect: Context switching (to volunteering records)
* **Alternative 1 (current choice):** Utilize `Context` class used in the `switch` function. (See <<Implementation-Switch>>)
Expand Down
14 changes: 7 additions & 7 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ Example(s):
Updates the panel displaying the list of volunteers to display the list of events. +
The following figure shows the expected panel before and after entering the `switch` command.

.Panel display changing from volunteers to events
.Panel display changing from list of volunteers to list of events
image::command_switch.png[switch, 500]
//end::command-switch[]

Expand Down Expand Up @@ -548,8 +548,8 @@ Format: `manage EVENT_INDEX`
Example(s):

* `switch -e` (panel updates to show list of events) +
`manage 1` (view the list of volunteers assigned to event at index 1) +
See the figures below for a step by step guide.
`manage 1` (view the list of volunteers assigned to the event at index 1) +
See the figures below for a step-by-step guide.

.Execute `switch -e`
image::command_switch.png[switch execution, 500]
Expand All @@ -560,11 +560,11 @@ image::command_record_manage_eventIndex.png[switch execution, 200]
.Labelled screenshot of what to expect after executing `manage 1`
image::command_manage_view.png[manage, 600]

The following changes are observed:
Refer to the labelled sections in the figure above for the following changes:

. Panel displays the list of volunteers that you can assign to an event.
. Name of event being managed and total number of volunteers assigned to it.
. List of volunteers currently assigned to the event. It will be empty if there are no volunteers assigned.
. The panel displays the list of volunteers that you can assign to an event.
. Name of the event being managed and total number of volunteers assigned to it.
. The list of volunteers currently assigned to the event. It will be empty if there are no volunteers assigned.

//end::command-record[]
[[command-record-add]]
Expand Down
36 changes: 19 additions & 17 deletions docs/team/imarbles.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,35 @@
== Overview

This portfolio page documents my involvement in SocialCare, a project done as part of the CS21303T Software Engineering module taught in NUS.
My team decided to develop SocialCare based on our goal of wanting to _'harness the potential of software to create sustainable social change'_.
For this project, my team had the goal to _'harness the potential of software to create sustainable social change'_.

SocialCare is a desktop application made for social welfare organizations.
The application is designed to help manage volunteers and events effectively.
Users interact with the application using a Command Line Interface (CLI).
In addition, SocialCare has a Graphical User Interface (GUI) to display information in a user-friendly manner.
With our goal in mind, we developed SocialCare, a desktop application made for social welfare organizations.
This application is designed to help manage volunteers and events effectively. This is done through the Command Line Interface (CLI), which help users to interact with the application; and the Graphical User Interface (GUI), which displays information in a user-friendly manner.

My main role as a developer for SocialCare was to implement *record management functions*, which enables users to do the following:
My main role as a developer for SocialCare was to implement *record management functions*, which enable users to do the following:

* Assign volunteers to event
* View volunteers assigned to an event
* Assign volunteers to an event
* Update volunteering records for volunteers
* Delete volunteering records of volunteer
* Delete volunteering records of volunteers

== Summary of Contributions
* *Major enhancement*:
added commands to *manage volunteer records*
Added commands to *manage volunteer records*
** What it does:
The commands implemented allows the user to manage volunteering records.
The commands implemented allow users to manage volunteering records.
They will be able to assign volunteers to events and update the number of hours contributed by the volunteer.

** Justification:
These functions are part of the core requirements for the application because we want users to be able to effectively manage volunteering records.

** Highlights:
This enhancement is completely new and required an in-depth analysis of design alternatives.
This enhancement was challenging as it required complete understanding of all code components so that it can be properly implemented.
It was challenging as to properly implement this, a complete understanding of all code components was needed.

* *Minor enhancement*:
added a command to allow users to *switch between panels*. The panels are used to display either volunteers or events for users to manage.
** Added a command to allow users to *switch between panels*.
** Created charts for the `overview` command.

* *Code contributed*:
Here is a https://nus-cs2103-ay1819s1.github.io/cs2103-dashboard/#=undefined&search=imarbles[link]
Expand All @@ -50,7 +50,7 @@ to my code on the Project Code Dashboard.
** Project management:
*** Set up the team repository on GitHub

*** Ensured that project deliverables are done on time and in the right format
*** Ensured that project deliverables were done on time and in the right format
** Documentation:
*** Did cosmetic tweaks to existing contents of the User Guide: link:{repoURL}/76/[#76], link:{repoURL}/129/[#129]
*** Rewrote the quick start section of the User Guide: link:{repoURL}/154/[#154]
Expand All @@ -64,18 +64,20 @@ to my code on the Project Code Dashboard.


|===
|_Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users._
| Below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users._
|===

include::../UserGuide.adoc[tag=command-switch]
include::../UserGuide.adoc[tag=command-record]
include::../UserGuide.adoc[tag=command-switch]


== Contributions to the Developer Guide

|===
|_Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project._
| Below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project._
|===

include::../DeveloperGuide.adoc[tag=command-switch]
include::../DeveloperGuide.adoc[tag=command-manage]
include::../DeveloperGuide.adoc[tag=command-switch]


0 comments on commit 70b5214

Please sign in to comment.