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

Add worker-pay command and tests #112

Merged
merged 4 commits into from
Oct 29, 2020

Conversation

plosslaw
Copy link

@plosslaw plosslaw commented Oct 28, 2020

Resolves #72

@plosslaw plosslaw added this to the v1.3 milestone Oct 28, 2020
Copy link

@wakululuu wakululuu left a comment

Choose a reason for hiding this comment

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

Looks good, some minor issues

public static final String COMMAND_WORD = "worker-pay";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Prints the pay earned by a worker identified by the index number used in the displayed worker list.\n"

Choose a reason for hiding this comment

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

Suggested change
+ ": Prints the pay earned by a worker identified by the index number used in the displayed worker list.\n"
+ ": Calculates the weekly pay earned by a worker identified by the index number used in the displayed worker list.\n"

Prints seems to be a more programming-specific term which the target user (ie. a McDonald's manager) may not understand.

}

Worker selectedWorker = lastShownList.get(targetIndex.getZeroBased());
float calculatedPay = model.calculateWorkerPay(selectedWorker);

Choose a reason for hiding this comment

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

I think implementing the logic of calculateWorkerPay() in this class itself may be more consistent with the rest of our commands. Maybe the rest can chip in on this

Choose a reason for hiding this comment

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

I think this is ok, for a possible future implementation could allow shifts of differing number of hours - hence calculating worker pay will need to be at a model level. Besides Worker has no knowledge of its assignments

Copy link
Author

Choose a reason for hiding this comment

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

Okay, I'll put calculateWorkerPay() in model for now. Putting calculateWorkerPay() in the command class is also fine.

@@ -21,6 +21,7 @@
*/
public class ModelManager implements Model {
private static final Logger logger = LogsCenter.getLogger(ModelManager.class);
private static final Integer HOURS_PER_SHIFT = 6;

Choose a reason for hiding this comment

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

Minor issue but 8 hours may be more realistic since McDonald's usually open for more than 12 hours a day

@codecov-io
Copy link

Codecov Report

Merging #112 into master will increase coverage by 0.03%.
The diff coverage is 75.86%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #112      +/-   ##
============================================
+ Coverage     70.05%   70.08%   +0.03%     
- Complexity      812      822      +10     
============================================
  Files           132      134       +2     
  Lines          2778     2808      +30     
  Branches        380      385       +5     
============================================
+ Hits           1946     1968      +22     
- Misses          711      716       +5     
- Partials        121      124       +3     
Impacted Files Coverage Δ Complexity Δ
.../seedu/address/logic/parser/AddressBookParser.java 50.00% <0.00%> (-1.62%) 12.00 <0.00> (ø)
src/main/java/seedu/address/model/Model.java 66.66% <ø> (ø) 2.00 <0.00> (ø)
...rc/main/java/seedu/address/model/ModelManager.java 82.69% <40.00%> (-5.48%) 40.00 <1.00> (+1.00) ⬇️
...seedu/address/logic/commands/WorkerPayCommand.java 100.00% <100.00%> (ø) 7.00 <7.00> (?)
...u/address/logic/parser/WorkerPayCommandParser.java 100.00% <100.00%> (ø) 2.00 <2.00> (?)

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 cc32008...5f36a33. Read the comment docs.

Copy link

@wakululuu wakululuu left a comment

Choose a reason for hiding this comment

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

LGTM

@wakululuu wakululuu merged commit 7cc3c86 into AY2021S1-CS2103-F10-4:master Oct 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show worker pay for the week
4 participants