Compare commits
2 Commits
3377092a3f
...
0.20
| Author | SHA1 | Date | |
|---|---|---|---|
| 276e18a9c8 | |||
| 61f2126c1b |
27
app.py
27
app.py
@@ -105,8 +105,8 @@ def inject_render_time():
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
# Redirect root to /fees for convenience while there are no other apps
|
||||
return '<meta http-equiv="refresh" content="0; url=/fees" />'
|
||||
# Redirect root to /adults for convenience while there are no other apps
|
||||
return '<meta http-equiv="refresh" content="0; url=/adults" />'
|
||||
|
||||
@app.route("/fees")
|
||||
def fees():
|
||||
@@ -582,7 +582,7 @@ def juniors_view():
|
||||
if expected == "?" or (isinstance(expected, int) and expected > 0):
|
||||
if expected == "?":
|
||||
status = "empty"
|
||||
cell_text = "?"
|
||||
cell_text = f"?{count_str}"
|
||||
elif paid >= expected:
|
||||
status = "ok"
|
||||
cell_text = f"{paid}/{fee_display}"
|
||||
@@ -705,6 +705,8 @@ def reconcile_juniors_view():
|
||||
# Filter to juniors for the main table
|
||||
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 = []
|
||||
for name in junior_names:
|
||||
data = result["members"][name]
|
||||
@@ -715,6 +717,23 @@ def reconcile_juniors_view():
|
||||
expected = mdata["expected"]
|
||||
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"
|
||||
cell_text = "-"
|
||||
amount_to_pay = 0
|
||||
@@ -722,7 +741,7 @@ def reconcile_juniors_view():
|
||||
if expected == "?" or (isinstance(expected, int) and expected > 0):
|
||||
if expected == "?":
|
||||
status = "empty"
|
||||
cell_text = "?"
|
||||
cell_text = f"?{count_str}"
|
||||
elif paid >= expected:
|
||||
status = "ok"
|
||||
cell_text = "OK"
|
||||
|
||||
@@ -17,7 +17,7 @@ class TestWebApp(unittest.TestCase):
|
||||
"""Test that / returns the refresh meta tag"""
|
||||
response = self.client.get('/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn(b'url=/fees', response.data)
|
||||
self.assertIn(b'url=/adults', response.data)
|
||||
|
||||
@patch('app.get_cached_data', side_effect=_bypass_cache)
|
||||
@patch('app.get_members_with_fees')
|
||||
|
||||
Reference in New Issue
Block a user