Skip to content

Commit

Permalink
Merge pull request #289 from qiujiaaa/docs
Browse files Browse the repository at this point in the history
Fix bug + edit docs
  • Loading branch information
zhixianggg authored Nov 11, 2019
2 parents a2a758c + e17130d commit cbef34a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
30 changes: 20 additions & 10 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -400,39 +400,49 @@ which is consistent with the unlimited number of `Tag` a `Customer` can hold.
=== Calendar / Schedule feature
==== Implementation

We decided to incorporate a third party library, _JFXtras's Agenda_, to represent our schedules on a calendar for easy viewing by our users.
===== Overview
We decided to incorporate a third party library, _JFXtras's Agenda_, to represent our schedules on a calendar for easy viewing by our users. +
The full documentation for `Agenda` can be found http://jfxtras.org/doc/8.0/jfxtras-agenda/index.html[here].

===== Calendar Panel
`CalendarPanel` is a wrapper class designed to contain `Agenda` for rendering events as a calendar. +
Here is the class diagram for `CalendarPanel`:

image::CalendarPanelClassDiagram.png[]

On instantiation of `CalendarPanel`, all the schedules in scheduleList will be converted to `Appointments` and then added to `Agenda` via `populateAgenda()`.
To set the display information of the `Schedule` object, we will find its `Order` in the orderList and retrieve its index.
===== Integration with SML
- On instantiation of `CalendarPanel`, all the schedules in scheduleList will be converted to `Appointments` and then added to `Agenda` via `populateAgenda()`.
- To set the display information of the `Schedule` object, we will find its `Order` in the orderList and retrieve its index.
- Date shown on the calendar will be today's date by default.
- Adds a listener to `scheduleList`.
- Adds a listener to `calendarDate`.

Schedule supports a few main commands:
===== Complementing CRUD commands
SML supports a few main `Schedule` commands:

* Add -- adds a new schedule into SML, command will be in this format: `add-s ORDER_INDEX cd/DATE ct/TIME v/VENUE [t/TAGS] [-allow]`
* Edit -- edits an existing schedule in SML, command will be in this format: `edit-s ORDER_INDEX [cd/DATE] [ct/TIME] [v/VENUE] [t/TAGS] [-allow]`
* Delete -- deletes an existing schedule in SML, command will be in this format: `delete-s ORDER_INDEX`
* Schedule -- switches the view on the panel to the week containing the date entered, command will be in this format: `schedule cd/DATE`

===== How the display works
The schedules and date in the calendar panel shows is automatically updated depending on the commands executed by the users.
For example:

* If the user adds/edits/deletes a schedule -- calendar panel will display the week with the date of the schedule.
* If the user uses the switch-s command -- calendar panel will display the week with today's date.
* If the user uses the schedule command -- calendar panel will display the week with the date requested by the user.

Changes to the schedules are made in the model by editing its own scheduleList.
`CalendarPanel` adds a listener to its `scheduleList` variable and listens to the changes and calls `populateAgenda()` to generate the updated list of `Schedules` into `Appointments` to add to `Agenda`.
Changes to the schedules are made in the `Model` by editing its own scheduleList.
`CalendarPanel` listens to the changes and calls `populateAgenda()` to generate the updated list of `Schedules` into `Appointments` to add to `Agenda`.

The current date shown on the calendar panel is encapsulated in a `CalendarDate` object.
The `CalendarDate` class uses `SimpleObjectProperty` to keep track of the Calendar (date).
The `CalendarDate` class uses `SimpleObjectProperty` to keep track of the Calendar (date) to be displayed.

When any of the schedule commands are executed, model will edit the `CalendarDate` object with the updated Calendar (date).
`CalendarPanel` adds a listener to its `CalendarDate` variable and listens to the changes and calls `setAgendaView()` to set the new `Calendar` in `CalendarDate` accordingly.
When any of the schedule commands are executed, model will edit `CalendarDate` with the updated Calendar (date).
`CalendarPanel` listens to the changes and calls `setAgendaView()` to set the new `Calendar` in `CalendarDate` accordingly.

Here is a sample of what happens when a user adds a schedule (AddScheduleCommand):
Here is an example of what happens when a user adds a schedule (AddScheduleCommand):

image::ScheduleCommandSequenceDiagram.png[]

Expand Down
4 changes: 3 additions & 1 deletion docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,9 @@ Format: `find-o KEYWORD [KEYWORD]...`


==== Complete an order : `complete`
Completes the order, order status changed to `COMPLETED`. Phone associated with order will also be deleted. +
Completes the order, order status changed to `COMPLETED`. +
Only `SCHEDULED` orders can be completed. +
Phone associated with order will also be deleted. +
Format: `complete INDEX`

==== Cancel an order : `cancel`
Expand Down
2 changes: 1 addition & 1 deletion docs/team/qiujiaaa.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ To make the application more user friendly, the application automatically switch
** Schedule commands (Logic) to complement the calendar display.
** Assisted to set up some parts in Model initially. (Order and Schedule)

* *Code contributed*: https://nus-cs2103-ay1920s1.github.io/tp-dashboard/#search=qiujiaaa&sort=groupTitle&sortWithin=title&since=2019-09-06&timeframe=commit&mergegroup=false&groupSelect=groupByRepos&breakdown=false[RepoSense tP Code Dashboard]
* *Code contributed*: https://nus-cs2103-ay1920s1.github.io/tp-dashboard/#search=qiujiaaa&sort=groupTitle&sortWithin=title&since=2019-09-06&timeframe=commit&mergegroup=false&groupSelect=groupByRepos&breakdown=false&tabOpen=false[RepoSense tP Code Dashboard]
** Functional Code
*** Calendar GUI (https://github.com/AY1920S1-CS2103T-T09-4/main/pull/105[#105])
*** Logic: Basic CRUD + other Schedule commands (https://github.com/AY1920S1-CS2103T-T09-4/main/pull/115[#115], https://github.com/AY1920S1-CS2103T-T09-4/main/pull/138/files[#138], https://github.com/AY1920S1-CS2103T-T09-4/main/pull/162[#162], https://github.com/AY1920S1-CS2103T-T09-4/main/pull/187[#187])
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/seedu/address/ui/cards/ArchivedOrderCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public ArchivedOrderCard(Order order, int displayedIndex) {
orderPrice.setText(order.getPrice().value);

if (order.getStatus().equals(Status.COMPLETED)) {
order.getSchedule().get().getTags().stream().sorted(Comparator.comparing(tag -> tag.tagName))
.forEach(tag -> scheduleTags.getChildren().add(new Label(tag.tagName)));
assert(order.getSchedule().isPresent());
try {
orderStatus.setText(String.format("%s : %s | Venue: %s", order.getStatus().toString(),
Expand All @@ -100,10 +102,6 @@ public ArchivedOrderCard(Order order, int displayedIndex) {
orderStatus.setText(order.getStatus().toString());
}

if (order.getSchedule().isPresent()) {
order.getSchedule().get().getTags().stream().sorted(Comparator.comparing(tag -> tag.tagName))
.forEach(tag -> scheduleTags.getChildren().add(new Label(tag.tagName)));
}
if (order.getCustomer() != null) {
order.getCustomer().getTags().stream()
.sorted(Comparator.comparing(tag -> tag.tagName))
Expand Down

0 comments on commit cbef34a

Please sign in to comment.