timeoff-management / timeoff-management-application

Simple yet powerful absence management software for small and medium size business (community edition)
https://TimeOff.Management
MIT License
932 stars 580 forks source link

Next year holidays with limited leave type #187

Closed vpp closed 6 years ago

vpp commented 6 years ago

Consider setup:

Company has two leave types

An employee X has one "Limited" holiday within this year.

Employee tries to add new request of either Limited or Unlimited type next year system shows an error of 'Requested absence is longer than remaining allowance' which is INCORRECT.

vpp commented 6 years ago

Update Brian when it is fixed.

vpp commented 6 years ago

After investigating the issue with account of client who reported it, it appeared that they use the "unusual setup" - they do not use department allowances and solely rely on individual employees' allowance adjustments. Which in general reasonable enough.

However the application have some assumption when calculating available allowance during placing new timeoff request: it assumes that employee adjustments are valid only in current year.

I do not see any reasons why the adjustment does not affect future years.

So I am going to amend the logic for future years when calculating available allowance to take into consideration not only department's allowance but employe allowance adjustment as well.

Code that is responsible for that is here: https://github.com/timeoff-management/application/blob/master/lib/model/mixin/user/absence_aware.js#L449