Deploy to K8s / deploy (push) Successful in 20s
Go (go/) becomes the primary implementation. The original Python version moves to legacy/ and is kept runnable; new features are still built in both (see the Dual implementation rule in CLAUDE.md). - git mv app.py, scripts/, templates/, tests/, pyproject.toml, uv.lock and build/ into legacy/ - Makefile: Python targets point at legacy/, venv in legacy/.venv, CREDENTIALS_PATH exported for the root .secret/ file - CI and make image build the Python image with legacy/ as context; the Makefile is no longer copied into the image - legacy/.dockerignore moved to the context root so it takes effect - CLAUDE.md, docs/README.md, Go comments, fixture README, capture script and VS Code launch config updated to the new layout Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.1 KiB
Go
35 lines
1.1 KiB
Go
// Package fees ports fee calculation from legacy/scripts/attendance.py.
|
|
package fees
|
|
|
|
const (
|
|
AdultFeeDefault = 700 // 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": 600, "2026-08": 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)
|
|
// 2+ → AdultFeeMonthlyRate[monthKey] or AdultFeeDefault
|
|
func CalculateFee(attendanceCount int, monthKey string) int {
|
|
if attendanceCount == 0 {
|
|
return 0
|
|
}
|
|
if attendanceCount == 1 {
|
|
return AdultFeeSingle
|
|
}
|
|
if rate, ok := AdultFeeMonthlyRate[monthKey]; ok {
|
|
return rate
|
|
}
|
|
return AdultFeeDefault
|
|
}
|