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

Get monthly fee + Get 3 months fee (this month + prev 2 months) function (Only supports non-recurring session for now) #118

Merged
merged 15 commits into from
Mar 28, 2021

Conversation

enhao25
Copy link

@enhao25 enhao25 commented Mar 26, 2021

Update with the following feature:

  1. Get monthly fee (E.g. fee n/John Doe m/1 y/2021) - Returns monthly fee of a particular student on the specific month and year
  2. Get 3 months fee (this month + prev 2 months) (E.g 3Month_Fee) - Returns past 3 months fee based on current list

Considerations:

  1. Only allows month between 1 to 12
  2. Only allows year between 1970 to 2037

Future Issues / Improvements:

  1. Test cases for command and command parser
  2. Might not need the command for 3Month_Fee if this is automatically in the UI.
  3. Only works on the filtered student, find_student will change the value (Could make it for all students instead of filtered students)
  4. Take into consideration for recurring session when it is done.

#81 #82

@enhao25 enhao25 added the type.Story A user story label Mar 26, 2021
@enhao25 enhao25 added this to the v1.3 milestone Mar 26, 2021
@enhao25 enhao25 self-assigned this Mar 26, 2021
Copy link

@JonahhGohh JonahhGohh left a comment

Choose a reason for hiding this comment

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

Tested it and works well!
I like how you compared the dateTime with the compareTo() method, clean af haha.

Regarding the 3 month command, I was thinking of using it for the Home fee section. So not too sure if we need a command for it.

@enhao25
Copy link
Author

enhao25 commented Mar 27, 2021

Tested it and works well!
I like how you compared the dateTime with the compareTo() method, clean af haha.

Regarding the 3 month command, I was thinking of using it for the Home fee section. So not too sure if we need a command for it.

Haha I agree ah! For the 3 month command thingy, I was also thinking that we might not need the command. So haven't added it to the UG yet. Probably can keep the command for testing purposes, and remove it after the UI that uses the 3 month function is done.

@codecov-io
Copy link

codecov-io commented Mar 27, 2021

Codecov Report

Merging #118 (79f0995) into master (91f37b2) will decrease coverage by 3.13%.
The diff coverage is 17.75%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #118      +/-   ##
============================================
- Coverage     69.54%   66.40%   -3.14%     
- Complexity      495      510      +15     
============================================
  Files            83       88       +5     
  Lines          1658     1765     +107     
  Branches        184      197      +13     
============================================
+ Hits           1153     1172      +19     
- Misses          439      521      +82     
- Partials         66       72       +6     
Impacted Files Coverage Δ Complexity Δ
...u/address/logic/commands/GetMonthlyFeeCommand.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...ddress/logic/commands/GetPrev3MonthFeeCommand.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
.../seedu/address/logic/parser/AddressBookParser.java 78.26% <0.00%> (-7.46%) 14.00 <0.00> (ø)
...dress/logic/parser/GetMonthlyFeeCommandParser.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...in/java/seedu/address/logic/parser/ParserUtil.java 58.22% <0.00%> (-17.19%) 17.00 <0.00> (ø)
src/main/java/seedu/address/model/Model.java 100.00% <ø> (ø) 1.00 <0.00> (ø)
...rc/main/java/seedu/address/model/ModelManager.java 76.71% <0.00%> (-15.10%) 27.00 <0.00> (ø)
src/main/java/seedu/address/model/fee/Year.java 61.53% <61.53%> (ø) 7.00 <7.00> (?)
src/main/java/seedu/address/model/fee/Month.java 64.28% <64.28%> (ø) 8.00 <8.00> (?)
...ain/java/seedu/address/logic/parser/CliSyntax.java 93.75% <100.00%> (+0.89%) 1.00 <0.00> (ø)
... and 5 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 91f37b2...79f0995. Read the comment docs.

@JonahhGohh JonahhGohh mentioned this pull request Mar 27, 2021
Copy link
Member

@nowknowing nowknowing left a comment

Choose a reason for hiding this comment

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

I think it works well! Just maybe could reduce repeat but i can't remember if we're marked on that. If not I think this is good!

}

@Override
public CommandResult execute(Model model) throws CommandException {
Copy link
Member

Choose a reason for hiding this comment

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

Im understanding that getPrev3 month is getMonth applied to every student, and for 3 months. I guess it'd be considered less "repeated code" if this method was built on getMonth. possibly using getMonth's methods from within getPrev3?

Copy link
Author

Choose a reason for hiding this comment

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

Ok good suggestion, the only common place for both code base is on model. Hence, I have abstracted out the get fees code over to model. Do have a look, the output should still be the same. Thank you!

Copy link
Member

Choose a reason for hiding this comment

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

super neat, hadn't thought of putting it at model!

Copy link
Member

@nowknowing nowknowing left a comment

Choose a reason for hiding this comment

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

LGTM!!

* Gets current month and previous 2 months expected monthly fee based on the current list of sessions
*/
public class GetPrev3MonthFeeCommand extends Command {
public static final String COMMAND_WORD = "3Month_Fee";
Copy link
Member

Choose a reason for hiding this comment

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

Might be consistent with the other commands if not capitalised. eg "past_fees" / "3_fees" / "3_month_fees"

Copy link
Author

Choose a reason for hiding this comment

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

Ahhh right! I have changed it to 3_month_fees instead.

public static final String COMMAND_WORD = "3Month_Fee";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Shows the total expected monthly fee"
+ "for this month + previous 2 months";
Copy link
Member

Choose a reason for hiding this comment

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

"Shows the totalled fees per month, for the past 3 months." Or something of the sort could be somewhat more accurate.

Copy link
Author

Choose a reason for hiding this comment

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

Alright! Change from that to "Shows the totalled fees per month, for this month + previous 2 months" instead.

@enhao25 enhao25 merged commit e9b7356 into AY2021S2-CS2103T-T11-1:master Mar 28, 2021
@enhao25
Copy link
Author

enhao25 commented Mar 28, 2021

closes #81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type.Story A user story
Projects
tP
  
Awaiting triage
Development

Successfully merging this pull request may close these issues.

None yet

4 participants