-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CS2113-T18-4] NUScents #18
base: master
Are you sure you want to change the base?
[CS2113-T18-4] NUScents #18
Conversation
Implement CalendarCommandParser
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall your code has decent abstraction and follow good OOP principles. However, continue looking into how you can refactor your code to make it more readable and neater!
String date = extractValue("allowance", arguments, DATE_PATTERN, false); | ||
String description = extractValue("allowance", arguments, DESC_PATTERN, false); | ||
String additionalInformation = extractValue("allowance", arguments, NOTE_PATTERN, true); | ||
String category = extractValue("allowance", arguments, CATEGORY_PATTERN, true); | ||
AllowanceCategory allowanceCategory = parseAllowanceCategory(category); | ||
String format = datePatternValidation(date); | ||
SimpleDateFormat formatter = new SimpleDateFormat(format); | ||
Date formattedDate = parseDate(date, format, formatter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you could abstract this out into a separate method, especially seeing how its quite similar to the code below.
private static void transactionDecoder(File file, ArrayList<Transaction> transactions) | ||
throws FileNotFoundException, ParseException, NuscentsException { | ||
Scanner data = new Scanner(file); | ||
while (data.hasNext()) { | ||
String transactionDetails = data.nextLine(); | ||
char transactionType = transactionDetails.charAt(0); | ||
String[] columns; | ||
float amount; | ||
Date date; | ||
String description = ""; | ||
String note = ""; | ||
String category= ""; | ||
SimpleDateFormat formatter = new SimpleDateFormat("dd MMMM, yyyy"); | ||
switch (transactionType) { | ||
case 'A': | ||
columns = transactionDetails.split("\\s*\\|\\s*"); | ||
amount = Float.parseFloat(columns[1]); | ||
date = formatter.parse(columns[2]); | ||
description = columns[3]; | ||
note = ""; | ||
if (columns.length > 4) { | ||
note = columns[4]; | ||
} | ||
AllowanceCategory allowanceCategory = null; | ||
if (columns.length > 5) { | ||
category = columns[5]; | ||
allowanceCategory = parseAllowanceCategory(category); | ||
} | ||
transactions.add(new Allowance(amount, date, description, note, allowanceCategory)); | ||
break; | ||
|
||
case 'E': | ||
columns = transactionDetails.split("\\s*\\|\\s*"); | ||
amount = Float.parseFloat(columns[1]); | ||
date = formatter.parse(columns[2]); | ||
description = columns[3]; | ||
if (columns.length > 4) { | ||
note = columns[4]; | ||
} | ||
ExpenseCategory expenseCategory = null; | ||
if (columns.length > 5) { | ||
category = columns[5]; | ||
expenseCategory = parseExpenseCategory(category); | ||
} | ||
transactions.add(new Expense(amount, date, description, note, expenseCategory)); | ||
break; | ||
|
||
default: | ||
break; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is a bit length, consider if you can use more abstraction to make it cleaner and shorter!
ui.showException(e); | ||
} catch (IOException | ParseException e) { | ||
Ui.showLine(); | ||
System.out.println("Something went wrong: " + e.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps printing of error message here can also go into your UI class for good SLAP.
|
||
if (isFound) { | ||
Ui.showFilterMessage(filteredTransactions, category); | ||
System.out.println("Filtered transactions in the category " + category + ":"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps your system output here can be moved to the UI class? This ensures each class has follows Single Responsibility Principle e.g. printing to the console is handled solely by the UI class.
@@ -0,0 +1,43 @@ | |||
package seedu.nuscents.ui; | |||
|
|||
public class Messages { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good use of a class to store your constant messages to be printed
Update UserGuide.md with quick start and command summary
Update User Guide with all current features.
Update developer guide with architecture diagram and minor fixes
Add hmac verification for storage file
Update UG to include categories for filter command and storage file FAQs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall a nice DG with great and understandable sequence diagrams, only minor formatting mistakes
| Version | As a ... | I want to ... | So that I can ... | | ||
|---------|--------------------|-----------------------------------------------------------|----------------------------------------------------------| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
The following sequence diagram shows how the add transaction operation works: | ||
|
||
<img src="images/AddTransactionSequenceDiagram.png" width="600" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/DeveloperGuide.md
Outdated
The following sequence diagram shows how the add transaction operation works: | ||
<img src="images/ViewSequenceDiagram.png" width="600" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/DeveloperGuide.md
Outdated
1. Parser | ||
|
||
The Parser class identifies the "view" command and extracts the taskIndex (transaction index) from the user's input. | ||
|
||
2. ViewCommand | ||
|
||
The ViewCommand object is created by the Parser. It encapsulates the user's request to view a specific transaction. This object is passed to the Nuscents class for execution. | ||
|
||
3. Nuscents | ||
|
||
In the Nuscents class, the execute() method of the ViewCommand is called, and the taskIndex is extracted from the command. It then calls the viewTransaction(taskIndex) method on the TransactionList. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
The following sequence diagram shows how the add transaction operation works: | ||
|
||
<img src="images/AddTransactionSequenceDiagram.png" width="600" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
The following sequence diagram shows how the add transaction operation works: | ||
|
||
<img src="images/AddTransactionSequenceDiagram.png" width="600" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the classes at the bottom required? I think it makes it confusing
and modifications. | ||
|
||
The following sequence diagram shows how the add transaction operation works: | ||
<img src="images/ViewSequenceDiagram.png" width="600" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
The following sequence diagram shows how the add transaction operation works: | ||
|
||
<img src="images/AddTransactionSequenceDiagram.png" width="600" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so when a parseCommand is called, a new addCommand and expense class is created? Should it not have the constructor method?
Fix user guide
Fix numbering typo in UserGuide.md
Fix table format
Fix table format to ensure correct format in deployment
Fix spaces between columns
docs/DeveloperGuide.md
Outdated
|
||
Given below is the example usage scenario and how the list transaction mechanism behaves at each step. | ||
|
||
Step 1. The user launches the application. The `TransactionList` will be initialized with the transactions stored in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be good to extract this file storage and retrieval out to a section on its own to explain how it works?
docs/DeveloperGuide.md
Outdated
|
||
### `helpCommand` Usage Scenario | ||
|
||
1. **Step 1**: The user launches the application. The initial screen appears. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if "1. Step 1" is necessary. would using "Step 1" suffice?
docs/DeveloperGuide.md
Outdated
|--------|----------|---------------|------------------| | ||
|v1.0|new user|see usage instructions|refer to them when I forget how to use the application| | ||
|v2.0|user|find a to-do item by name|locate a to-do without having to go through the entire list| | ||
Version | As a ... | I want to ... | So that I can ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The formatting for the User Stories seems to be broken on the page
Fix table borders in UG
Add Imgaes For AboutUs.md
Include more class diagrams
Update Implementation: list transactions feature
Update UG FAQ and PPP
Fix reposense link
Update PPP for spaceman03
Fix github pages formatting issue
Add note in UserGuide.md
Add table of contents to DG
Fix format in DG list implementation steps, add instructions for manual testing
PPP bug fix: formatting issues
Update README.md
bug fix: update links in README.md
Welcome to NUScents, the tailor-made financial tracker for SOC students at NUS. It is optimized for use via a Command Line Interface (CLI) to offer a clutter-free solution for our users to manage and monitor their financial activities.