simplify calculate_monthly_fee to linear formula

Rates are CHF 130/indoor day and CHF 250/outdoor day — exactly linear.
Replace the if/elif table with indoor_days * 130 + outdoor_days * 250.

https://claude.ai/code/session_01LjjK7RjKVnC8bETtccfgna
This commit is contained in:
Claude
2026-02-23 15:06:47 +00:00
parent 54d88d1d64
commit f1d0ad045c
+1 -9
View File
@@ -104,15 +104,7 @@ def calculate_monthly_fee(registration: RegistrationData) -> str:
"""Compute the monthly fee string from the booking selection.""" """Compute the monthly fee string from the booking selection."""
indoor_days = sum(1 for d in registration.booking.selected_days if d.type == "indoor") indoor_days = sum(1 for d in registration.booking.selected_days if d.type == "indoor")
outdoor_days = sum(1 for d in registration.booking.selected_days if d.type == "outdoor") outdoor_days = sum(1 for d in registration.booking.selected_days if d.type == "outdoor")
fee = 0 fee = indoor_days * 130 + outdoor_days * 250
if indoor_days == 1:
fee += 130
elif indoor_days == 2:
fee += 260
elif indoor_days >= 3:
fee += 390
if outdoor_days >= 1:
fee += 250
return f"CHF {fee}.-" return f"CHF {fee}.-"