Files
fuj-management/legacy/scripts/calculate_fees.py
kacerrandClaude Opus 5.5 022facc957
Deploy to K8s / deploy (push) Successful in 20s
refactor: move Python implementation to legacy/, make Go primary
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>
2026-10-08 11:33:57 +02:00

54 lines
1.4 KiB
Python

#!/usr/bin/env python3
"""Calculate monthly fees from the FUJ Tuesday practice attendance sheet."""
from datetime import datetime
from attendance import get_members_with_fees
def main():
members, sorted_months = get_members_with_fees()
if not members:
print("No data.")
return
# Filter to adults only for display
results = [(name, fees) for name, tier, fees in members if tier == "A"]
# Format month labels
month_labels = {
m: datetime.strptime(m, "%Y-%m").strftime("%b %Y") for m in sorted_months
}
# Print table
name_width = max((len(r[0]) for r in results), default=20)
col_width = 15
header = f"{'Member':<{name_width}}"
for m in sorted_months:
header += f" | {month_labels[m]:>{col_width}}"
print(header)
print("-" * len(header))
monthly_totals = {m: 0 for m in sorted_months}
for name, month_fees in results:
line = f"{name:<{name_width}}"
for m in sorted_months:
fee, count = month_fees[m]
monthly_totals[m] += fee
cell = f"{fee} CZK ({count})" if count > 0 else "-"
line += f" | {cell:>{col_width}}"
print(line)
# Totals row
print("-" * len(header))
totals_line = f"{'TOTAL':<{name_width}}"
for m in sorted_months:
cell = f"{monthly_totals[m]} CZK"
totals_line += f" | {cell:>{col_width}}"
print(totals_line)
if __name__ == "__main__":
main()