Skip to content

Commit

Permalink
Merge pull request AY2425S1-CS2103T-F13-4#83 from beginner-web-develo…
Browse files Browse the repository at this point in the history
…per/update-uml-for-view-transactions

Update DG for listt
  • Loading branch information
reginateh authored Oct 22, 2024
2 parents 51e23fc + b3dadac commit 5e94a23
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,27 @@ Classes used by multiple components are in the `seedu.address.commons` package.

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

### List Transactions `listt INDEX`

#### Implementation

The list transactions command allows for users to view all transactions for the specified person. Notably, when the command is used, `Model#updateFilteredPersonList()` is called to update the person list to just contain that specified person. It also implements the following operations:

* `Model#setIsViewTransactions(boolean)` — Displays the person list in the GUI when false, and displays the transactions list in the GUI when true.
* `Model#updateTransactionList(ObservableList<Transaction>)` — Updates the transaction list to contain transactions for the specified person.

The following sequence diagram shows an example execution of command `listt 1`.

<puml src="diagrams/ListTransactionsDiagram.puml" width="550" />

#### Side Effects

As a result of `listt INDEX` changing the person list, operations on the transactions (e.g. `deletet` and `summary`) can now be performed on the transactions list, without specifying the person index.

The following activity diagram shows how the user should use some of our transaction-related commands.

<puml src="diagrams/ListTransactionsActivityDiagram.puml" width="550" />

### \[Proposed\] Undo/redo feature

#### Proposed Implementation
Expand Down
22 changes: 22 additions & 0 deletions docs/diagrams/ListTransactionsActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@startuml
skin rose
skinparam ActivityFontSize 15
skinparam ArrowFontSize 12
start
:User executes listt command;
:Model updates person list;
:GUI displays transactions list;

'Since the beta syntax does not support placing the condition outside the
'diamond we place it as the true branch instead.

if () then ([execute deletet command])
:Delete transaction;
:Model updates transaction list;
else([execute summary command])
:Model filters transaction list;
endif

:GUI displays transaction list;
stop
@enduml
58 changes: 58 additions & 0 deletions docs/diagrams/ListTransactionsDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant "t:ListTransactionCommand" as ListTransactionCommand LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
end box
[-> LogicManager : execute(listt 1)
activate LogicManager

LogicManager -> AddressBookParser : parseCommand(listt 1))
activate AddressBookParser

create ListTransactionCommand
AddressBookParser -> ListTransactionCommand
activate ListTransactionCommand

ListTransactionCommand --> AddressBookParser
deactivate ListTransactionCommand

AddressBookParser --> LogicManager : t
deactivate AddressBookParser

LogicManager -> ListTransactionCommand : execute()
activate ListTransactionCommand

ListTransactionCommand -> Model : updateFilteredPersonList()
activate Model

Model --> ListTransactionCommand
deactivate Model

ListTransactionCommand -> Model : setViewTransactions(true)
activate Model

Model --> ListTransactionCommand
deactivate Model

ListTransactionCommand -> Model : updateTransactionList()
activate Model

Model --> ListTransactionCommand
deactivate Model

ListTransactionCommand --> LogicManager : result
deactivate ListTransactionCommand
ListTransactionCommand -[hidden]-> LogicManager : result
destroy ListTransactionCommand

[<--LogicManager
deactivate LogicManager
@enduml

0 comments on commit 5e94a23

Please sign in to comment.