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 unavailability #84

Merged

Conversation

tnsyn
Copy link

@tnsyn tnsyn commented Oct 20, 2020

  • Create Unavailability class
  • Add Unavailability field for Worker
  • Modify worker-add and worker-edit commands to parse unavailability field
  • Modify assign command to check Worker unavailability
  • Add basic testing for Unavailability

Resolves #62
Resolves #64

Copy link

@WangZijun97 WangZijun97 left a comment

Choose a reason for hiding this comment

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

Looks great mostly! Just have a couple implementation choices to ask about (open to everyone else to reply too I guess?)


if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_PAY)
if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_ADDRESS, PREFIX_PHONE, PREFIX_PAY, PREFIX_ROLE)

Choose a reason for hiding this comment

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

I think role is an optional argument so perhaps no need to check if it is present.
Actually since we are on this topic, I think pay isn't either? But if these are necessary then perhaps updating the User Guide will do.

Copy link
Author

Choose a reason for hiding this comment

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

Mm I just thought that it made sense for all workers to have a role so I included it as a compulsory field, but we can take it out also I guess? So if a worker doesn't have any roles specified, then we can assign them to any role in a shift
If we're going to be implementing the Pay calculation feature then we should make Pay compulsory

Choose a reason for hiding this comment

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

I think no role should be unable to assign to anything, kind of like when someone new join and havent do the training I guess. Makes sense for pay to be compulsory, so agreed there.

Copy link
Author

Choose a reason for hiding this comment

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

Ah ok agreed for role! Will make the change

FRI,
SAT,
SUN
}

Choose a reason for hiding this comment

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

Thanks for abstracting this out properly xD

public static final String MESSAGE_CONSTRAINTS =
"Shift time should only contain one of the following values: AM, PM";
public final TimeValue time;
"Shift time should only contain one of the following values: AM, PM, FULL";

Choose a reason for hiding this comment

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

I'm not sure if the FULL value should be implemented into the code itself, or should it just be an argument that we accept that from user input that is essentially a wrapper for creating both an AM and a PM unavailability. Not sure if this might result in duplicates when creating shifts of AM and of FULL of the same day?

Copy link
Author

Choose a reason for hiding this comment

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

Made the change to convert FULL to AM and PM unavailabilities

@codecov-io
Copy link

codecov-io commented Oct 21, 2020

Codecov Report

Merging #84 into master will decrease coverage by 0.51%.
The diff coverage is 59.11%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #84      +/-   ##
============================================
- Coverage     65.03%   64.51%   -0.52%     
- Complexity      568      587      +19     
============================================
  Files           100      105       +5     
  Lines          2059     2181     +122     
  Branches        231      248      +17     
============================================
+ Hits           1339     1407      +68     
- Misses          657      702      +45     
- Partials         63       72       +9     
Impacted Files Coverage Δ Complexity Δ
...main/java/seedu/address/commons/core/Messages.java 0.00% <ø> (ø) 0.00 <0.00> (ø)
...va/seedu/address/logic/commands/AssignCommand.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...edu/address/logic/commands/ShiftDeleteCommand.java 58.82% <0.00%> (ø) 8.00 <0.00> (ø)
...seedu/address/logic/commands/ShiftEditCommand.java 66.66% <0.00%> (ø) 13.00 <0.00> (ø)
.../seedu/address/logic/commands/UnassignCommand.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...seedu/address/logic/commands/WorkerAddCommand.java 100.00% <ø> (ø) 8.00 <0.00> (ø)
...edu/address/logic/parser/UnavailabilitySyntax.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
src/main/java/seedu/address/ui/WorkerCard.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...in/java/seedu/address/logic/parser/ParserUtil.java 63.00% <11.11%> (-19.20%) 24.00 <1.00> (+1.00) ⬇️
.../java/seedu/address/model/util/SampleDataUtil.java 44.68% <20.00%> (-2.69%) 5.00 <1.00> (+1.00) ⬇️
... and 17 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 6370511...d4a5d4a. Read the comment docs.

Copy link

@WangZijun97 WangZijun97 left a comment

Choose a reason for hiding this comment

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

Looks great!

@WangZijun97 WangZijun97 merged commit b84c043 into AY2021S1-CS2103-F10-4:master Oct 21, 2020
@tnsyn tnsyn modified the milestones: v1.3, mid-v1.3 Oct 22, 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.

Modify assign to check Worker available timings Add list of unavailable timings to Worker
3 participants