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: Calculate earned leaves pro-rata if policy assignment is created after the leave period #2704

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

asmitahase
Copy link
Collaborator

Problem

If leave policy is assigned for a backdated year, earned leaves are still calculated based on the current date at which the assignment is created, this works out if the leave period is shorter than a year, but fails for a period when the months repeat.
For example,

  1. Leave Type is set to earned leave with a monthly frequency to be allocated on the last day of the month.
  2. Leave period is set to last years start date and end date
  3. Annual Leave are set as 12 in the leave policy
  4. Leave policy is assigned on this years first month

Then total leave allocated should 12, but 11 leave are assigned, the month in which is assignment is made is excluded because the assignment should be done on the last day, even though the month is outside the leave period

Solution

If a leave assignment is made outside the leave period that implies that employee has earned all leaves. Hence assign them pro-rata instead.

  • Fixed a test
  • Added two new tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant