feat: improve attendance parsing logic and fix payment date formatting
This commit is contained in:
@@ -58,14 +58,31 @@ def calculate_fee(attendance_count: int) -> int:
|
||||
|
||||
|
||||
def get_members(rows: list[list[str]]) -> list[tuple[str, str, list[str]]]:
|
||||
"""Parse member rows. Returns list of (name, tier, row)."""
|
||||
"""Parse member rows. Returns list of (name, tier, row).
|
||||
|
||||
Stopped at row where first column contains '# last line'.
|
||||
Skips rows starting with '#'.
|
||||
"""
|
||||
members = []
|
||||
for row in rows[1:]:
|
||||
name = row[COL_NAME].strip() if len(row) > COL_NAME else ""
|
||||
if not name or name.lower() in ("jméno", "name", "jmeno"):
|
||||
if not row or len(row) <= COL_NAME:
|
||||
continue
|
||||
|
||||
first_col = row[COL_NAME].strip()
|
||||
|
||||
# Terminator for rows to process
|
||||
if "# last line" in first_col.lower():
|
||||
break
|
||||
|
||||
# Ignore comments
|
||||
if first_col.startswith("#"):
|
||||
continue
|
||||
|
||||
if not first_col or first_col.lower() in ("jméno", "name", "jmeno"):
|
||||
continue
|
||||
|
||||
tier = row[COL_TIER].strip().upper() if len(row) > COL_TIER else ""
|
||||
members.append((name, tier, row))
|
||||
members.append((first_col, tier, row))
|
||||
return members
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user