Updated functions based on new staffing logic #67
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
We have moved to a new model for staffing, and need to update the functions that have to do with status to reflect the changes.
These key changes have been made:
staffing
andabsence
tables now have apercentage
column to represent their respective staffing levels.How
Percentage levels and absence overlap:
Instead of counting every day and multiplying by 7.5, we now count hours based on the percentage of staffing/absence (100% = 7.5 hours).
Absence percentage always overrides staffing, so if someone is 50% staffed, 90% absent, only the staffing percentage will be affected.
The math for getting staffing hours in one day works out to be something like this:
Availability is calculated differently, as everything except absence or staffing with an
unavailable
reason/project is counted as available time.Progress
kpi_functions.sql
time_tracking_status.sql
worked_days_per_week.sql ✅
reporting_functions.sql ✅
-is_possible_work_day
-possible_work_dates_per_employee
+available_hours_per_employee
*accumulated_staffing_hours