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

Updated functions based on new staffing logic #67

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

petternett
Copy link
Contributor

@petternett petternett commented Dec 6, 2024

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:

  • The staffing and absence tables now have a percentage column to represent their respective staffing levels.
  • Absence will overlap projects, so that employees can be staffed uninterrupted for as long as their contract is valid. This makes it a lot easier to handle situations where employees undo an addition of absence, because we can "fall back" to the original staffing. However, this means that simply counting every day with staffing present in the table will overestimate the staffing hours, as absence can "override" it.

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:

absence hours = absence_percentage * 0.075
staffing hours = MIN( staffing_percentage, 100 - absence_percentage ) * 0.075

Availability is calculated differently, as everything except absence or staffing with an unavailable reason/project is counted as available time.

available hours = MAX( 100 - staffing_unavailable_percentage - absent_unavailable_percentage, 0 ) * 0.075

Progress

kpi_functions.sql

  • unavailable_staffing_hours
    • Kun staffing, regner for mange timer hvis man har ferie oppå utiligjengelig bemanning.
  • planned_billable_hours
    • Med på å regne ut FG.
  • unavilable_staffing_dates_in_period
  • forcasted_available_hours

time_tracking_status.sql

  • staffed_billable_days_for_employees
  • staffed_nonbillable_days_for_employees
  • staffed_unavailable_days_for_employees
  • time_tracking_status_with_staffing

worked_days_per_week.sql ✅

  • worked_days_per_week
    • Burde ha med alle dager der sum av absence < 100%

reporting_functions.sql ✅

-is_possible_work_day
-possible_work_dates_per_employee
+available_hours_per_employee
*accumulated_staffing_hours

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.

2 participants