Skip to content

Commit

Permalink
Merge pull request #77 from jeffsieu/branch-Update-Task-Filter-Docs
Browse files Browse the repository at this point in the history
Update DevGuide with better TaskFilter explanations
  • Loading branch information
wlren authored Oct 24, 2021
2 parents 0ceb8fb + 3fd8170 commit f696bcd
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 13 deletions.
41 changes: 33 additions & 8 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,11 @@ Each `Command` will have a different way of implementing `undo()`, depending on
- Add: Deletes the object at the last index
- Delete: Adds the deleted task at the original deleted index
- Edit: Restores the state to the pre-edit state

2. GUI View Commands:

- Find/Sort/Filter: Restores the previous `Predicate` that was in the `FilteredList`

### Task filter feature

#### Current implementation
Expand All @@ -266,27 +266,52 @@ The task filtering mechanism is facilitated by `Model`. Each task filter is inte

##### Example usage of `addTaskFilter`

Step 1. The user launches the application and creates a task with the tag `important`.
Step 1. The user enters the command to filter tasks by the tag `important`.

Step 2. `ModelManager.recalculateFilteredTaskList()` is called. The selected `TaskFilter` instances are combined by
mapping them to their respective predicates using `TaskFilter.getPredicate()`. The resultant predicates are
combined by repeatedly applying `Predicate::and` on all predicates.

Step 2. The user adds the task filter `Tagged [important]`.
Step 3. The resultant predicate represents the collective filtering achieved by applying every selected task filter.

![Sequence diagram](http://www.plantuml.com/plantuml/png/VL3DJiCm3BxxAQ9osGvxWMgQ1eSXf4tQ0HuWDEw85gTLuY0U7pk5qY74fNQ_dyzszfbjua81RCT3ClVrQxCf6HECmldEZpQoUNnvKbmAl0uVfZaE5zyrvkxeBs_y40hUg9ksyYSRxGLJeyv0WD4PCSEKS1eS1aau-tZzPQxKqanqg-XzO4pedcs-vlRmzNVqcRSAxQgfvv-9O0iFSgD_juncYA07cirE3sgDTSwm-CoK2o2eae4gfv7JZ1NFxHe2gOR-rT2iITZPq9LW6G-BxNNdrHeMmZAwlpJOzwZxurbGtubaTlNScemy4wjn8T5JjfkgcP85a849kQG8t_MsG23nR0nHjMiRQ7eoxGM3FKPNA7m2)
Step 4. The `FilteredList` representing the filtered task list is updated by calling
`filteredTasks.setPredicate(predicate)`.

Step 3: The GUI is updated to show only tasks tagged Important.
Step 5. The GUI is updated automatically by JavaFX to show only tasks tagged `important`.

The following sequence diagram shows the above steps.

![Sequence diagram showing the recalculation of available task filters when a new task is added](images/AddTaskFilterSequenceDiagram.png)

##### Adding tasks

Tasks can be filtered by tag. Whenever a task is added, the list of task filters will be recalculated to include the new tags introduced by adding that task.

Step 1. The user adds a new task.

Step 2. `Logic.addTask(task)` is called, which then delegates the responsibility to `ModelManager` via
`ModelManager.addTask(task)`.

Step 3. `ModelManager` recomputes task filter options with `recomputeAvailableTaskFilters()`.

Step 4. The new list will contain task filters representing done, and undone tasks.

Step 5. All `Tag`s are extracted from every task in the task list, and collected in a `Set`.

Step 6. Each `Tag` is mapped into a `TaskFilter` matching tasks that contain that corresponding tag.

Step 7. The list of available task filters is updated and reflected in the GUI.
The list of active filters remains unchanged.

The following sequence diagram shows how task filters are recalculated on the addition of a task.

![Sequence diagram](http://www.plantuml.com/plantuml/png/bOvDKiCm38NtFeKcRCA22sIOJik2LJgmu09Ah0PF9JjZou7ZuxhJK7vOiB76x-bxUjka63KBco6yGzE7oOqDtFHkUjK7pcJcOhlHpUWLcgxwU_GuKMm04x0OyXOAV0xO1qjS0fwTFtvZgtNDYdpTm0KTuy3qWkduw5WffWwUXaHnESczIth_wMrg2EfXRM0mQy1HtO9A4Bovsm1B1sZj2MkrFBU61OekFtHPzKXZa3ahxNvfr5usKGyTZ4mOYrG-gvPdYrhRaZy3aJH7RovpvMk57NFhwUtgn3_Z_ffRyZOBVm00)
![Sequence diagram showing the update to task filters when a new task is added](images/AddTaskUpdateTaskFilterSequenceDiagram.png)

##### Deleting tasks

Deleting tasks may cause associated tags to be deleted from the entire task list. If a tag is deleted, its corresponding task filter will have to be deleted.

![Delete task activity diagram](http://www.plantuml.com/plantuml/png/bOynJi0m34Ltdy8RxHMQWGwS036oXEO78foar4ubRa_QY86HBVfvxqbUrVnXBGlT3rgUyTMWnkRramC4bcfnb29FBzUqrM8-5Hr_21ryryUPxGE5fs_eJCozakk9Fyp3ICOaXaDVIpngPd_w9FvDuFvZAGHR9tvdHn05JwNEX19IfENfRjookuxQQjvR7uQ1CBAIr1ofrPtMBhOiFm00)
![Activity diagram showing the task filter list's update when a task is deleted](images/DeleteTaskActivityDiagram.png)

##### `TaskFilter` implementation

Expand Down
31 changes: 31 additions & 0 deletions docs/diagrams/AddTaskFilterSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@startuml
!include style.puml

actor Actor as user
participant UI as UI UI_COLOR

box "Logic" LOGIC_COLOR_T1
participant ":LogicManager" as lm LOGIC_COLOR
end box

box "Model" MODEL_COLOR_T1
participant ":ModelManager" as mm MODEL_COLOR
participant "filteredTasks:FilteredList<Task>" as ft MODEL_COLOR
end box

autoactivate on
user -> UI: add task filter
UI -> lm: addTaskFilter(taskFilter)
lm -> mm: addTaskFilter(taskFilter)
mm -> mm: recalculateFilteredTaskList()
mm -> mm: updateFilteredTaskList(effectivePredicate)
mm -> ft: setPredicate(predicate)
UI <- ft: update gui
return
return
return
return
lm <-- mm
GUI <-- lm
user <-- GUI
@enduml
29 changes: 29 additions & 0 deletions docs/diagrams/AddTaskUpdateTaskFilterSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@startuml
!include style.puml

box "Logic" LOGIC_COLOR_T1
participant ":LogicManager" as lm LOGIC_COLOR
end box
box "Model" MODEL_COLOR_T1
participant ":ModelManager" as mm MODEL_COLOR
participant "availableTaskFilters: ObservableList<TaskFilter>" as atf MODEL_COLOR
end box

autoactivate on
-> lm: addTask(task)
lm -> mm: addTask(task)
mm -> mm: recomputeAvailableTaskFilters()
mm -> atf: clear()
atf -> atf: updateListeners()
return
return

mm -> atf: addAll(newTaskFilters)
atf -> atf: updateListeners()

return
return
return
return
return
@enduml
12 changes: 12 additions & 0 deletions docs/diagrams/DeleteTaskActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@startuml
start
:Request task deletion;
if () then ([Task contains deleted tags])
:Remove deleted tags' task filters\nfrom available;
:Remove deleted tags' task filters\nfrom selected filters;
else ([else])
endif
:Delete task;
:Recompute filtered task list;
stop
@enduml
Binary file added docs/images/AddTaskFilterSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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/DeleteTaskActivityDiagram.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 @@ -26,7 +26,7 @@ For **contributing to the project**:

## About Us

Please refer to the [About Us](https://github.com/AY2122S1-CS2103-F09-2/tp/blob/master/docs/AboutUs.md) document.
Please refer to the [About Us](https://github.com/AY2122S1-CS2103-F09-2/tp/blob/master/docs/AboutUs.md) document.

## User Guide

Expand Down
2 changes: 1 addition & 1 deletion docs/team/jeffsieu.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Technologies: ReactJS, Flutter

## Work Experience

NA (Enlisted in the RSAF)
NA (Enlisted in the RSAF)

## Projects and Competitions

Expand Down
2 changes: 1 addition & 1 deletion docs/team/mingyi456.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Programming competencies: C/C++, Java, Python

- Worked on a greenfield project on a basic task management chatbot in Java.

#### (In progress) PC3288 Advanced UROPS in Physics I
#### (In progress) PC3288 Advanced UROPS in Physics I

- Working to help develop an automated ion beam targeting system for facilitating ion beam therapy research on cancer cells in Python.

Expand Down
4 changes: 2 additions & 2 deletions docs/team/wlren.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ Technologies: Flutter, Unity, AWS (Cloud Practitioner certified)
#### [Multiverse](https://github.com/wlren/multiverse)
- Attained highest level of “Artemis” (top 8% in cohort of 700) in CP2106 Independent Software
Development Project

- Identified poor UX in NUS Campus related applications and designed a solution of a mobile
application which integrates 4 campus applications under a single dashboard

- Co-built android application using Flutter and Firebase, with emphasis on proper Software
Development Life Cycle, using Mockito as unit testing library

Expand Down

0 comments on commit f696bcd

Please sign in to comment.