Skip to content

Commit

Permalink
Merge pull request #134 from isaaceng7/93-fix-dg-list
Browse files Browse the repository at this point in the history
Update DG list feature
  • Loading branch information
isaaceng7 committed Apr 9, 2024
2 parents 4c6cd7c + 70c05af commit 5249a66
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 14 deletions.
15 changes: 10 additions & 5 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,18 +196,23 @@ Sequence Diagram
The following sequence diagram illustrates the sequence of interactions involved in the editing of a transaction:
![](./uml/uml-images/processEditTransactionDiagram.png)

### [Implemented] List feature
### [Implemented] List Transactions

### Description

The list feature allows users to view their existing transactions. This feature includes viewing all the transactions,
past week's transactions, past month's transactions and transactions from a specified date range.

#### Implementation
#### Design and Implementation

This feature is facilitated through the `TransactionList#processList`, and it is designed to ensure successful viewing
of the desired list as inputs are required in a bite-sized manner.

This feature is facilitated through the `TransactionList#processList`, where it prompts the user for their choice of
list they wish to see. After the user inputs the choice, the get functions will store the transactions in a new
ArrayList and `UserInterface#printPastTransactions` will handle the output of the list.
This method first executes the `UserInterface#printListOptions` to show users the list options and their indexes which
is needed for their inputs. The method will throw an InvalidIndexException if the input is out of the range.
Depending on the list option chosen by the user, different prompts and messages will be output. For options which
require more data by the user, this feature will prompt the user to input the data. Once all required information is
gathered, the method will call on the various methods to build an ArrayList of the desired list and print out the list.

Sequence Diagram
The following sequence diagram illustrates the sequence of interactions involved in the editing of a transaction:
Expand Down
53 changes: 44 additions & 9 deletions docs/uml/processList.puml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
autonumber

actor User
participant "TransactionManager" as TM
participant "UserInterface" as UI
participant ":TransactionManager" as TM
participant ":UserInterface" as UI
participant "LocalDate" as LD
participant ":AccountManager" as AM

User -> TM: processList()
TM -> UI: printListOptions()
Expand All @@ -16,33 +17,33 @@ deactivate UI
User -> TM: selectOption(option)
TM -> TM: determineAction(option)

alt Option 1 (All Transactions)
alt 1: All Transactions
TM -> TM: printTransactions()
TM -> UI: printTransactions()
activate UI
UI --> User: Display all transactions
deactivate UI
else Option 2 (Past Week Transactions)
else 2: Past Week Transactions
TM -> LD: now()
activate LD
LD --> TM: today
deactivate LD
TM -> TM: calculateStartDate("week")
TM -> TM: filterTransactions(startDate)
TM -> TM: getPastTransactions(startDate)
TM -> UI: printPastTransactions(transactions, "week")
activate UI
UI --> User: Display past week transactions
deactivate UI
else Option 3 (Past Month Transactions)
else 3: Past Month Transactions
TM -> LD: now()
LD --> TM: today
TM -> TM: calculateStartDate("month")
TM -> TM: filterTransactions(startDate)
TM -> TM: getPastTransactions(startDate)
TM -> UI: printPastTransactions(transactions, "month")
activate UI
UI --> User: Display past month transactions
deactivate UI
else Option 4 (Custom Date Transactions)
else 4: Custom Date Transactions
TM -> UI: getStartDate()
activate UI
UI --> TM: startDate
Expand All @@ -52,10 +53,44 @@ else Option 4 (Custom Date Transactions)
UI --> TM: endDate
deactivate UI
TM -> TM: parseDates(startDate, endDate)
TM -> TM: filterTransactions(startDate, endDate)
TM -> TM: getCustomDateTransactions(startDate, endDate)
TM -> UI: printCustomDateTransactions(transactions)
activate UI
UI --> User: Display custom date transactions
deactivate UI
else 5: Account Transactions
TM -> UI: printAccountList(accounts)
activate UI
UI --> User: Display account list
deactivate UI
TM -> UI: getSelectedAccountNumber(accounts)
activate UI
UI --> TM: accountNumber
deactivate UI
TM -> AM: getAccountByAccountNumber(accountNumber)
activate AM
AM --> TM: account
deactivate AM
TM -> TM: getAccountTransactions(transactions, accountNumber)
TM -> UI: printAccountTransactions(accountTransactions, accountName, accountNumber)
activate UI
UI ---> User: Display account transactions
deactivate UI
else 6: Category Transactions
TM -> UI: listCategories()
activate UI
UI --> User: Display category list
deactivate UI
TM -> UI: getSelectedCategory()
activate UI
UI --> TM: categorySelected
deactivate UI
TM -> TM: fromNumber(category)
TM -> TM: getCategoryName()
TM -> TM: getCategoryTransactions(transactions, categorySelected)
TM -> UI: printCategoryTransactions(categoryTransactions, categoryName)
activate UI
UI --> User: Display category transactions
deactivate UI
end
@enduml
Binary file modified docs/uml/uml-images/processList.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5249a66

Please sign in to comment.