Skip to content
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

Fix error messages for payment class and refactored code #163

Merged
merged 4 commits into from
Nov 4, 2021

Conversation

ykwei7
Copy link

@ykwei7 ykwei7 commented Nov 3, 2021

Resolved #147, #126

For #147, changed payment message from Overdue: No (By: XXX) to Overdue: No (Next payment date by: XXX) to make it more explicit that it refers to the next upcoming payment date to be expected.

For #126, adjusted according to what was suggested and changed error message to tutee index is invalid.

Added test cases for payment commands as well

@ykwei7 ykwei7 linked an issue Nov 3, 2021 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Nov 3, 2021

Codecov Report

Merging #163 (b1faa30) into master (23c2ab1) will increase coverage by 0.90%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #163      +/-   ##
============================================
+ Coverage     78.52%   79.42%   +0.90%     
- Complexity      685      696      +11     
============================================
  Files            95       95              
  Lines          2095     2095              
  Branches        255      258       +3     
============================================
+ Hits           1645     1664      +19     
+ Misses          374      361      -13     
+ Partials         76       70       -6     
Impacted Files Coverage Δ
...in/java/seedu/address/logic/parser/ParserUtil.java 92.66% <ø> (ø)
...gic/commands/paymentcommand/PaymentAddCommand.java 90.62% <100.00%> (+37.05%) ⬆️
.../logic/commands/paymentcommand/PaymentCommand.java 94.73% <100.00%> (+0.98%) ⬆️
...commands/paymentcommand/PaymentReceiveCommand.java 93.75% <100.00%> (+22.78%) ⬆️
...mmands/paymentcommand/PaymentSetAmountCommand.java 95.83% <100.00%> (+0.18%) ⬆️
...commands/paymentcommand/PaymentSetDateCommand.java 96.00% <100.00%> (+0.16%) ⬆️
...c/main/java/seedu/address/model/tutee/Payment.java 86.27% <100.00%> (+0.56%) ⬆️
...c/main/java/seedu/address/model/lesson/Lesson.java 86.48% <0.00%> (+3.15%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 23c2ab1...b1faa30. Read the comment docs.

@ykwei7 ykwei7 closed this Nov 3, 2021
@ykwei7 ykwei7 reopened this Nov 3, 2021
Copy link

@atyhamos atyhamos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job on the thorough test cases! Left a few comments and suggestions. 😄


if (zeroPaymentVal.equals(existingPaymentValue) && newPayByDate == null && existingPayByDate == null) {
boolean hasZeroPaymentValue = ZERO_PAYMENT_VAL.equals(existingPaymentValue);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As "0" is not equal to "0.00", perhaps a simpler implementation would be

Suggested change
boolean hasZeroPaymentValue = ZERO_PAYMENT_VAL.equals(existingPaymentValue);
boolean hasZeroPaymentValue = Double.parseDouble(existingPaymentValue) == 0;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Have committed the above suggestions

@@ -126,7 +126,7 @@ public String getOverdueStatus() {
} else if (payByDateAsString.equals("-")) {
return "No (Pay-by date not set)";
} else {
return "No (by " + payByDateAsString + ")";
return "No (Next payment date by: " + payByDateAsString + ")";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will clear the confusion that our testers had 😅

@atyhamos atyhamos merged commit a5e8d47 into AY2122S1-CS2103T-F12-3:master Nov 4, 2021
@nhjryan nhjryan added this to the v1.4 milestone Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants