From 259dd3e4892b0367d88f37c293af77bd747e9468 Mon Sep 17 00:00:00 2001 From: Sim Justin <1sim.justin@gmail.com> Date: Mon, 15 Apr 2024 20:36:27 +0800 Subject: [PATCH] DG pagination --- docs/DeveloperGuide.md | 47 ++++++++++++++++++++++++----------------- text-ui-test/runtest.sh | 4 ++-- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index b0e5e83ec0..f4426f611d 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -374,8 +374,6 @@ The `GroupList` class takes the following into consideration. * `createGroup` checks if the groupList is empty and automatically prompts the user to create a new group if it is and sets it as the active group. * `loadGroupList` is called at the start of the application to ensure that all groups are loaded from storage into the groupList. -
- ### Member and MemberList Overview @@ -473,6 +471,8 @@ members.clearBalances(); members.delete("Bob"); ``` +
+ Design Considerations The `Member` class takes the following into consideration. @@ -484,8 +484,6 @@ The `MemberList` class takes the following into consideration. * `updateMembersBalance` clears current balances at the start of invocation. This removes any transactions that are not captured within the `TransactionList` object passed into the method. -
- ### Transaction and TransactionList Transaction Overview @@ -712,7 +710,8 @@ import longah.util.Transaction; // In toString() method of the Transaction Class // Checks whether the current transaction has a dateTime component if (this.haveTime()) { - time = "Transaction time: " + this.transactionTime + "\n"; //Initiates a toString() call to the DateTime class + // Initiate a toString() call to the DateTime class + time = "Transaction time: " + this.transactionTime + "\n"; } ``` @@ -723,16 +722,10 @@ The following UML diagram displays how the dateTime component is compared with u Given below is an example usage scenario of how the `DateTime` class behaves at each step when comparison is initiated by filter methods. -1. Upon receiving a filtering request, the `TransactionList` class first initiates the DateTime constructor and attempts -to store the user's dateTime Expression into a `DateTime` object. -2. After the successful creation of the userDateTime object, the filtering method proceeds by looping through all -transactions in the current list. -3. For every transaction, the `TransactionList` first gets the dateTime object of the transaction by calling the -getTransactionTime() method of the `Transaction` class. -4. A comparison request (in this case .isEqual()) of the `DateTime` class is initiated, comparing the transactionDateTime -as well as userDateTime objects of the class. -5. Depending on the Boolean value determining the result of comparison, the filtering method will then proceed to decide -if the current transaction is to be added to the printout. +1. Upon receiving a filtering command, the `TransactionList` class initiates the `DateTime` constructor to store the user's dateTime Expression into a `DateTime` object. +2. For every transaction, the `TransactionList` first gets the dateTime object of the transaction by calling the getTransactionTime() method of the `Transaction` class. +3. A comparison method (in this case .isEqual()) of the `DateTime` class is initiated, comparing the transactionDateTime as well as userDateTime objects of the class. +4. Depending on the Boolean value determining the result of comparison, the filtering method will then proceed to decide if the current transaction is to be added to the printout.
@@ -780,6 +773,8 @@ and authentication status. Note: PIN is disabled by default and needs to be set upon first startup. +
+ Implementation Details *Data Storage:* @@ -812,24 +807,28 @@ If the file does not exist or the savedPin is empty, it calls the createPin meth - *getPinFilePath*: Returns the file path of the PIN file. - *createPin*: Prompts the user to create a new 6-digit PIN and hashes it before saving. - *authenticate*: Authenticates the user by comparing the entered PIN with the saved PIN. -- *resetPin*: Resets the PIN for the user by prompting for the current PIN and creating a new PIN if the current - -PIN is correct. +- *resetPin*: Resets the PIN for the user by prompting for the current PIN and creating a new PIN if the current PIN is correct. - *enablePin*: Enables authentication upon startup. - *disablePin*: Disables authentication upon startup. - *getSavedPin*: Returns the saved PIN. - *getAuthenticationStatus*: Returns the authentication status. +
+ Usage Example The following diagram illustrates the sequence during PIN authentication. ![pinhandler longah.png](diagrams/pinhandler%20longah.png) +
+ This diagram shows the sequence when the user resets their PIN. ![pinreset.png](diagrams/pinreset.png) +
+ Given below is an example usage scenario and how the PIN creation and authentication mechanism behaves at each step: 1. The user launches the application for the first time. The PINHandler initializes, loading the saved PIN and @@ -848,7 +847,7 @@ is set to false and saved to the file. 8. The user relaunches the application, and authentication is no longer required since it has been disabled. The user can proceed with the application and do any actions without entering a PIN. -Code Segment +Code Segment: ``` // Initialize PINHandler PINHandler pinHandler = new PINHandler(); @@ -862,6 +861,8 @@ PINHandler.authenticate(); } ``` +
+ Design Considerations Resetting PIN: The resetPin() method allows users to change their PIN by first verifying their current PIN. This adds @@ -901,6 +902,8 @@ The `Chart` class consists of the following components: distinguishes positive and negative balances and adds tooltips for enhanced user interaction. Additionally, it includes an annotation recommending a command for managing debts effectively. +
+ Usage Example Given below is an example usage scenario and how the Chart class behaves at each step: @@ -932,6 +935,8 @@ hovered over. Annotation: An annotation is included to suggest a command for managing debts efficiently, ensuring users are aware of available features within the application. +
+ ### Exceptions and Logging Overview @@ -969,6 +974,8 @@ The `Logging` class has the following key methods: * *logInfo*: Takes a string `message` as an argument. Create a log at the INFO level. * *logWarning*: Takes a string `message` as an argument. Create a log at the WARNING level. +
+ Usage Example Use of the `LongAhException` class is demonstrated below, including throwing of an exception and printing the desired output message. This example covers the throwing exception due to invalid index. @@ -1007,6 +1014,8 @@ Busy people with large transaction quantities among friends - Help users to find the least transactions solution to a large quantity of transactions - Allow users to view past expenses of a group +
+ ## User Stories | Version | As a ... | I want to ... | So that I can ... | diff --git a/text-ui-test/runtest.sh b/text-ui-test/runtest.sh index 7a2f4318fa..902dc916cd 100755 --- a/text-ui-test/runtest.sh +++ b/text-ui-test/runtest.sh @@ -19,7 +19,7 @@ check_test() { local expected_output="$2" local actual_output="$3" local test_name="$4" - local -n error_count_ref="$5" + local error_count_ref="$5" local failed_tests_ref="$6" # Run the test and generate actual output @@ -40,7 +40,7 @@ check_data() { local expected_output="$1" local actual_output="$2" local test_name="$3" - local -n error_count_ref="$4" + local error_count_ref="$4" local failed_tests_ref="$5" cp "$expected_output.TXT" "$expected_output-UNIX.TXT"