SeaWolf-AI commited on
Commit
73db23b
Β·
verified Β·
1 Parent(s): fb12f93

fixed-causes list shows all causes.json entries (67), not only cause-keyed ones

Browse files
Files changed (2) hide show
  1. challenge.html +1 -1
  2. rt_challenge.py +11 -1
challenge.html CHANGED
@@ -291,7 +291,7 @@ function board(){const s=SEA[CUR],t=s[L],st=state(CUR),rows=(DATA.seasons||{})[C
291
  if(st!=='open'){cl.style.display='block';cl.textContent=st==='soon'?T('Submissions for this season open when it starts.','이 μ‹œμ¦Œμ€ κ°œλ§‰ν•˜λ©΄ μ œμΆœν•  수 μžˆμŠ΅λ‹ˆλ‹€.'):T('This season is closed.','이 μ‹œμ¦Œμ€ μ’…λ£Œλ˜μ—ˆμŠ΅λ‹ˆλ‹€.');document.getElementById('f').style.display='none';document.getElementById('needlogin').style.display='none'}
292
  else{cl.style.display='none';document.getElementById('needlogin').style.display=ME?'none':'block';document.getElementById('f').style.display=ME?'block':'none'}}
293
  function causes(){const cs=DATA.causes||[];document.getElementById('st_fix').textContent=cs.length;
294
- document.getElementById('causes').innerHTML=cs.length?'<table class="ctab"><thead><tr><th>#</th><th>'+T('Cause','원인')+'</th><th>'+T('Season','μ‹œμ¦Œ')+'</th><th>'+T('Found by','발견자')+'</th><th>'+T('Status','μƒνƒœ')+'</th></tr></thead><tbody>'+cs.map((c,i)=>'<tr><td>'+(i+1)+'</td><td><b>'+esc(L==='ko'?c.ko:c.en)+'</b></td><td>'+esc((SEA[c.season]||SEA.s1)[L][0])+'</td><td>'+esc(c.finder)+'</td><td><span class="fix">'+T('Fixed','μˆ˜μ • μ™„λ£Œ')+(c.fixed_at?' Β· '+esc(c.fixed_at.slice(5)):'')+'</span></td></tr>').join('')+'</tbody></table><p class="mut" style="font-size:12px;margin:10px 0 0">'+T('Shell check families accepted so far: ','μ§€κΈˆκΉŒμ§€ μΈμ •λœ μ…Έ νŒμ • 계열: ')+(DATA.families||0)+'</p>':'<div class="empty">'+T('No accepted causes yet.','아직 μΈμ •λœ 원인이 μ—†μŠ΅λ‹ˆλ‹€.')+'</div>'}
295
  function hallf(){const fmt=t=>t?new Date(t*1000).toLocaleDateString(L==='ko'?'ko-KR':'en-US',{year:'numeric',month:'short',day:'numeric'}):'';
296
  let h='';
297
  for(const k of Object.keys(SEA)){const t=SEA[k][L],w=DATA.windows[k]||{},st=state(k),rows=((DATA.seasons||{})[k]||[]).slice(0,10);
 
291
  if(st!=='open'){cl.style.display='block';cl.textContent=st==='soon'?T('Submissions for this season open when it starts.','이 μ‹œμ¦Œμ€ κ°œλ§‰ν•˜λ©΄ μ œμΆœν•  수 μžˆμŠ΅λ‹ˆλ‹€.'):T('This season is closed.','이 μ‹œμ¦Œμ€ μ’…λ£Œλ˜μ—ˆμŠ΅λ‹ˆλ‹€.');document.getElementById('f').style.display='none';document.getElementById('needlogin').style.display='none'}
292
  else{cl.style.display='none';document.getElementById('needlogin').style.display=ME?'none':'block';document.getElementById('f').style.display=ME?'block':'none'}}
293
  function causes(){const cs=DATA.causes||[];document.getElementById('st_fix').textContent=cs.length;
294
+ document.getElementById('causes').innerHTML=cs.length?'<table class="ctab"><thead><tr><th>#</th><th>'+T('Cause','원인')+'</th><th>'+T('Season','μ‹œμ¦Œ')+'</th><th>'+T('Found by','발견자')+'</th><th>'+T('Status','μƒνƒœ')+'</th></tr></thead><tbody>'+cs.map((c,i)=>'<tr><td>'+(i+1)+'</td><td><b>'+esc(L==='ko'?c.ko:c.en)+'</b></td><td>'+(c.season?esc((SEA[c.season]||SEA.s1)[L][0]):'Β·')+'</td><td>'+esc(c.finder||'Β·')+'</td><td><span class="fix">'+T('Fixed','μˆ˜μ • μ™„λ£Œ')+(c.fixed_at?' Β· '+esc(c.fixed_at.slice(5)):'')+'</span></td></tr>').join('')+'</tbody></table><p class="mut" style="font-size:12px;margin:10px 0 0">'+T('Shell check families accepted so far: ','μ§€κΈˆκΉŒμ§€ μΈμ •λœ μ…Έ νŒμ • 계열: ')+(DATA.families||0)+'</p>':'<div class="empty">'+T('No accepted causes yet.','아직 μΈμ •λœ 원인이 μ—†μŠ΅λ‹ˆλ‹€.')+'</div>'}
295
  function hallf(){const fmt=t=>t?new Date(t*1000).toLocaleDateString(L==='ko'?'ko-KR':'en-US',{year:'numeric',month:'short',day:'numeric'}):'';
296
  let h='';
297
  for(const k of Object.keys(SEA)){const t=SEA[k][L],w=DATA.windows[k]||{},st=state(k),rows=((DATA.seasons||{})[k]||[]).slice(0,10);
rt_challenge.py CHANGED
@@ -273,7 +273,17 @@ def leaderboard():
273
  hall[c["finder"]]["causes"] += 1
274
  for sea, (_at, u) in first.items():
275
  hall[u]["first"].append(sea)
276
- extra = {"causes": sorted(causes.values(), key=lambda c: c["at"]),
 
 
 
 
 
 
 
 
 
 
277
  "hall": sorted(hall.values(), key=lambda h: (-h["causes"], -(h["S"] + h["A"]), -h["B"], h["user"].lower())),
278
  "families": sum(h["B"] for h in hall.values()), "submissions": n_subs}
279
  _cache.update(t=time.time(), board=board, extra=extra)
 
273
  hall[c["finder"]]["causes"] += 1
274
  for sea, (_at, u) in first.items():
275
  hall[u]["first"].append(sea)
276
+ # The "fixed causes" list must show every cause recorded in causes.json, not only the ones whose
277
+ # judgement carried a cause key. Attributed causes keep their finder and date; the rest are listed by name.
278
+ if names:
279
+ all_causes = []
280
+ for k, nm in names.items():
281
+ nm = nm if isinstance(nm, dict) else {}
282
+ all_causes.append(causes.get(k) or {"key": k, "en": nm.get("en", k), "ko": nm.get("ko", k),
283
+ "season": "", "finder": "", "at": "", "fixed_at": ""})
284
+ else:
285
+ all_causes = list(causes.values())
286
+ extra = {"causes": sorted(all_causes, key=lambda c: (c["at"] == "", c["at"], c["key"])),
287
  "hall": sorted(hall.values(), key=lambda h: (-h["causes"], -(h["S"] + h["A"]), -h["B"], h["user"].lower())),
288
  "families": sum(h["B"] for h in hall.values()), "submissions": n_subs}
289
  _cache.update(t=time.time(), board=board, extra=extra)