Tilt works by tracking how much time off an employee has taken. In this exercise an employee may take a maximum of 12 weeks of leave per 12-month period.
Your task is to calculate the number of remaining leave hours from the initial
12-week allocation, using the provided as_of_date.
The 12-month period is determined by a given tracking_method.
The period is January 1 through December 31 of the year containing the as_of_date.
The period begins on the date the employee was hired and resets every 12 months.
- An employee can take a total of 12-weeks of leave per 12-month period.
- The employee works 40 hours per week (Monday–Friday).
- Leave is taken in full weeks only.
- Each
LeaveEventrepresents one or more full weeks. - Each
LeaveEventis in a single 12-month period and will not cross into the next period. - Ignore holidays.
- All dates are valid and formatted
%Y-%m-%d.
Implement the calendar tracking method inside:
calculate_remaining_fmla_hours(as_of_date: str) -> float
The function must:
- Count leave used within that period up to and including
as_of_date - Return remaining hours
Once the calendar method is working, add support for the fixed method inside
calculate_remaining_fmla_hours