feat(fees): adult rates for 2026-07 to 2026-12, default 600
- Default adult monthly rate 700 -> 600 CZK - 2026-07 and 2026-08 set to 0; 2026-09 through 2026-12 added at 600 - Single-session fee is capped at the month's rate, so a 0-rate month is free for one session as well - Mirrored in Go and legacy Python; new calculate_fee parity fixtures Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -115,6 +115,15 @@ SEEDS[("calculate_fee", "two_sessions_reduced_march")] = {
|
||||
SEEDS[("calculate_fee", "two_sessions_default_fallback")] = {
|
||||
"attendance_count": 2, "month_key": "2099-01"
|
||||
}
|
||||
SEEDS[("calculate_fee", "two_sessions_free_july")] = {
|
||||
"attendance_count": 2, "month_key": "2026-07"
|
||||
}
|
||||
SEEDS[("calculate_fee", "one_session_free_july")] = {
|
||||
"attendance_count": 1, "month_key": "2026-07"
|
||||
}
|
||||
SEEDS[("calculate_fee", "two_sessions_october")] = {
|
||||
"attendance_count": 2, "month_key": "2026-10"
|
||||
}
|
||||
|
||||
|
||||
# --- calculate_junior_fee ---
|
||||
|
||||
@@ -10,7 +10,7 @@ from config import ATTENDANCE_SHEET_ID as SHEET_ID, JUNIOR_SHEET_GID
|
||||
EXPORT_URL = f"https://docs.google.com/spreadsheets/d/{SHEET_ID}/export?format=csv&gid=0"
|
||||
JUNIOR_EXPORT_URL = f"https://docs.google.com/spreadsheets/d/{SHEET_ID}/export?format=csv&gid={JUNIOR_SHEET_GID}"
|
||||
|
||||
ADULT_FEE_DEFAULT = 700 # CZK, for 2+ practices in a month
|
||||
ADULT_FEE_DEFAULT = 600 # CZK, for 2+ practices in a month
|
||||
ADULT_FEE_SINGLE = 200 # CZK, for exactly 1 practice in a month
|
||||
ADULT_FEE_MONTHLY_RATE = {
|
||||
"2025-09": 750,
|
||||
@@ -23,8 +23,12 @@ ADULT_FEE_MONTHLY_RATE = {
|
||||
"2026-04": 700,
|
||||
"2026-05": 450,
|
||||
"2026-06": 600,
|
||||
"2026-07": 600,
|
||||
"2026-08": 600,
|
||||
"2026-07": 0,
|
||||
"2026-08": 0,
|
||||
"2026-09": 600,
|
||||
"2026-10": 600,
|
||||
"2026-11": 600,
|
||||
"2026-12": 600,
|
||||
}
|
||||
|
||||
JUNIOR_FEE_DEFAULT = 500 # CZK for 2+ practices
|
||||
@@ -91,12 +95,13 @@ def group_by_month(dates: list[tuple[int, datetime]], merged_months: dict[str, s
|
||||
|
||||
|
||||
def calculate_fee(attendance_count: int, month_key: str) -> int:
|
||||
"""Apply fee rules: 0 → 0, 1 → 200, 2+ → configured rate (default 750)."""
|
||||
"""Apply fee rules: 0 → 0, 1 → 200 (capped at the month's rate), 2+ → configured rate (default 600)."""
|
||||
if attendance_count == 0:
|
||||
return 0
|
||||
rate = ADULT_FEE_MONTHLY_RATE.get(month_key, ADULT_FEE_DEFAULT)
|
||||
if attendance_count == 1:
|
||||
return ADULT_FEE_SINGLE
|
||||
return ADULT_FEE_MONTHLY_RATE.get(month_key, ADULT_FEE_DEFAULT)
|
||||
return min(ADULT_FEE_SINGLE, rate)
|
||||
return rate
|
||||
|
||||
|
||||
def calculate_junior_fee(attendance_count: int, month_key: str) -> str | int:
|
||||
|
||||
Reference in New Issue
Block a user