- 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>
38 lines
1.3 KiB
Go
38 lines
1.3 KiB
Go
// Package fees ports fee calculation from legacy/scripts/attendance.py.
|
|
package fees
|
|
|
|
const (
|
|
AdultFeeDefault = 600 // CZK fallback for 2+ practices when month not in AdultFeeMonthlyRate
|
|
AdultFeeSingle = 200 // CZK for exactly 1 practice
|
|
)
|
|
|
|
// AdultFeeMonthlyRate mirrors ADULT_FEE_MONTHLY_RATE in legacy/scripts/attendance.py.
|
|
// Months absent from this map fall back to AdultFeeDefault.
|
|
var AdultFeeMonthlyRate = map[string]int{
|
|
"2025-09": 750, "2025-10": 750, "2025-11": 750, "2025-12": 750,
|
|
"2026-01": 750, "2026-02": 750, "2026-03": 350,
|
|
"2026-04": 700, "2026-05": 450, "2026-06": 600, "2026-07": 0, "2026-08": 0,
|
|
"2026-09": 600, "2026-10": 600, "2026-11": 600, "2026-12": 600,
|
|
}
|
|
|
|
// CalculateFee returns the adult fee in CZK for attendanceCount practices in
|
|
// the given monthKey (format "YYYY-MM").
|
|
//
|
|
// 0 practices → 0
|
|
// 1 practice → AdultFeeSingle (200), capped at the month's rate so a
|
|
// 0-rate month is free for everyone
|
|
// 2+ → AdultFeeMonthlyRate[monthKey] or AdultFeeDefault
|
|
func CalculateFee(attendanceCount int, monthKey string) int {
|
|
if attendanceCount == 0 {
|
|
return 0
|
|
}
|
|
rate, ok := AdultFeeMonthlyRate[monthKey]
|
|
if !ok {
|
|
rate = AdultFeeDefault
|
|
}
|
|
if attendanceCount == 1 {
|
|
return min(AdultFeeSingle, rate)
|
|
}
|
|
return rate
|
|
}
|