feat: Show attendance breakdown for single-visit junior fees
All checks were successful
Build and Push / build (push) Successful in 8s
All checks were successful
Build and Push / build (push) Successful in 8s
When a junior attended only once in a month (fee = "?"), the dashboard cells now display the attendance details (e.g., "? (1:1J)") instead of a bare "?". Applied to both /juniors and /reconcile-juniors routes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
23
app.py
23
app.py
@@ -582,7 +582,7 @@ def juniors_view():
|
|||||||
if expected == "?" or (isinstance(expected, int) and expected > 0):
|
if expected == "?" or (isinstance(expected, int) and expected > 0):
|
||||||
if expected == "?":
|
if expected == "?":
|
||||||
status = "empty"
|
status = "empty"
|
||||||
cell_text = "?"
|
cell_text = f"?{count_str}"
|
||||||
elif paid >= expected:
|
elif paid >= expected:
|
||||||
status = "ok"
|
status = "ok"
|
||||||
cell_text = f"{paid}/{fee_display}"
|
cell_text = f"{paid}/{fee_display}"
|
||||||
@@ -705,6 +705,8 @@ def reconcile_juniors_view():
|
|||||||
# Filter to juniors for the main table
|
# Filter to juniors for the main table
|
||||||
junior_names = sorted([name for name, tier, _ in adapted_members])
|
junior_names = sorted([name for name, tier, _ in adapted_members])
|
||||||
|
|
||||||
|
junior_members_dict_rc = {name: fees_dict for name, _, fees_dict in junior_members}
|
||||||
|
|
||||||
formatted_results = []
|
formatted_results = []
|
||||||
for name in junior_names:
|
for name in junior_names:
|
||||||
data = result["members"][name]
|
data = result["members"][name]
|
||||||
@@ -715,6 +717,23 @@ def reconcile_juniors_view():
|
|||||||
expected = mdata["expected"]
|
expected = mdata["expected"]
|
||||||
paid = int(mdata["paid"])
|
paid = int(mdata["paid"])
|
||||||
|
|
||||||
|
orig_fee_data = junior_members_dict_rc.get(name, {}).get(m)
|
||||||
|
adult_count = 0
|
||||||
|
junior_count = 0
|
||||||
|
att_count = 0
|
||||||
|
if orig_fee_data and len(orig_fee_data) == 4:
|
||||||
|
_, att_count, adult_count, junior_count = orig_fee_data
|
||||||
|
|
||||||
|
breakdown = ""
|
||||||
|
if adult_count > 0 and junior_count > 0:
|
||||||
|
breakdown = f":{junior_count}J,{adult_count}A"
|
||||||
|
elif junior_count > 0:
|
||||||
|
breakdown = f":{junior_count}J"
|
||||||
|
elif adult_count > 0:
|
||||||
|
breakdown = f":{adult_count}A"
|
||||||
|
|
||||||
|
count_str = f" ({att_count}{breakdown})" if att_count > 0 else ""
|
||||||
|
|
||||||
status = "empty"
|
status = "empty"
|
||||||
cell_text = "-"
|
cell_text = "-"
|
||||||
amount_to_pay = 0
|
amount_to_pay = 0
|
||||||
@@ -722,7 +741,7 @@ def reconcile_juniors_view():
|
|||||||
if expected == "?" or (isinstance(expected, int) and expected > 0):
|
if expected == "?" or (isinstance(expected, int) and expected > 0):
|
||||||
if expected == "?":
|
if expected == "?":
|
||||||
status = "empty"
|
status = "empty"
|
||||||
cell_text = "?"
|
cell_text = f"?{count_str}"
|
||||||
elif paid >= expected:
|
elif paid >= expected:
|
||||||
status = "ok"
|
status = "ok"
|
||||||
cell_text = "OK"
|
cell_text = "OK"
|
||||||
|
|||||||
Reference in New Issue
Block a user