Spaces:
Running
Running
leaderboard: credit every family of a multi-family judgement (causes list) with finder, date and fix mark
Browse files- rt_challenge.py +7 -5
rt_challenge.py
CHANGED
|
@@ -275,10 +275,12 @@ def leaderboard():
|
|
| 275 |
h[tier] = h.get(tier, 0) + n
|
| 276 |
if at and (sea not in first or at < first[sea][0]):
|
| 277 |
first[sea] = (at, u)
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
|
|
|
|
|
|
| 282 |
except Exception: # noqa: BLE001
|
| 283 |
pass
|
| 284 |
board = {}
|
|
@@ -297,7 +299,7 @@ def leaderboard():
|
|
| 297 |
for k, nm in names.items():
|
| 298 |
nm = nm if isinstance(nm, dict) else {}
|
| 299 |
all_causes.append(causes.get(k) or {"key": k, "en": nm.get("en", k), "ko": nm.get("ko", k),
|
| 300 |
-
"season": "", "finder": "", "at": "", "fixed_at": ""})
|
| 301 |
else:
|
| 302 |
all_causes = list(causes.values())
|
| 303 |
extra = {"causes": sorted(all_causes, key=lambda c: (c["at"] == "", c["at"], c["key"])),
|
|
|
|
| 275 |
h[tier] = h.get(tier, 0) + n
|
| 276 |
if at and (sea not in first or at < first[sea][0]):
|
| 277 |
first[sea] = (at, u)
|
| 278 |
+
# a judgement may accept several families at once; their keys are in "causes" (2026-11-20)
|
| 279 |
+
keys = ([j["cause"]] if j.get("cause") else []) + [x for x in (j.get("causes") or []) if isinstance(x, str)]
|
| 280 |
+
for ck in dict.fromkeys(keys):
|
| 281 |
+
if ck not in causes or at < causes[ck]["at"]:
|
| 282 |
+
nm = names.get(ck, {})
|
| 283 |
+
causes[ck] = {"key": ck, "en": nm.get("en", ck), "ko": nm.get("ko", ck), "season": sea, "finder": u, "at": at, "fixed_at": j.get("fixed_at", "")}
|
| 284 |
except Exception: # noqa: BLE001
|
| 285 |
pass
|
| 286 |
board = {}
|
|
|
|
| 299 |
for k, nm in names.items():
|
| 300 |
nm = nm if isinstance(nm, dict) else {}
|
| 301 |
all_causes.append(causes.get(k) or {"key": k, "en": nm.get("en", k), "ko": nm.get("ko", k),
|
| 302 |
+
"season": "", "finder": "", "at": "", "fixed_at": nm.get("fixed_at", "")})
|
| 303 |
else:
|
| 304 |
all_causes = list(causes.values())
|
| 305 |
extra = {"causes": sorted(all_causes, key=lambda c: (c["at"] == "", c["at"], c["key"])),
|