fix: on-call time inflated monthly hours and vanished from On-Call tab - #42
Merged
Conversation
…ations Stats' period total/average summed all sessions including on-call-active ones, inflating monthly "usual hours" by the on-call portion. It now excludes on-call time, matching the income calc's existing behavior. OnCallBilling.activeMinutesWithinBillable required on-call-active time to fall inside a scheduled rotation window to count, so ad hoc escalations outside the schedule were silently dropped from the On-Call tab. Renamed to activeMinutes and reworked to count any on-call-active time (minus overlap with non-billable working hours), regardless of schedule.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
OnCallBilling.activeMinutesWithinBillableonly counted on-call-active time that fell inside a scheduled rotation window, so an ad hoc escalation outside any scheduled on-call shift was silently dropped — invisible in the On-Call tab and not eligible for active-rate income. Renamed toactiveMinutesand reworked to count on-call-active time regardless of schedule, still excluding overlap with normal working hours (non-billable rules).Also fixed a couple of related issues so days consisting only of on-call time are still tappable in the Stats bar chart (previously the tap/chevron were gated on regular hours only).
Test plan
swift test— 66 tests pass, including new cases for unscheduled escalations (activeMinutes_unscheduledEscalationCountsInFull,activeMinutes_unscheduledEscalationExcludesNonBillableOverlap)swift build— clean build