Implement foerderquote calculation logic

This commit is contained in:
Rob committed 2026-04-21 15:29:56 +02:00
1 parent f2da062c49
commit 88d7f81723
2 files changed
+19 -4

No files matched your search

+15
View File
@@ -1 +1,16 @@
"""Record matching logic across allocation and master data."""
from __future__ import annotations
from .errors import ValidationError
from .models import AllocationRecord
def calculate_foerderquote_percent(allocation: AllocationRecord, precision: int = 2) -> float:
if allocation.contract_hours_weekly <= 0:
raise ValidationError(
"contract_hours_weekly must be greater than 0 for foerderquote calculation."
)
raw_share = (allocation.funded_hours_weekly / allocation.contract_hours_weekly) * 100.0
return round(raw_share, precision)