3v324v23 commited on
Commit
804a0a2
·
1 Parent(s): 74dcebe

fix(ui): align calibration visibility

Browse files
Files changed (1) hide show
  1. static/index.html +4 -3
static/index.html CHANGED
@@ -4427,9 +4427,10 @@ function drawFlags(){
4427
  if(!flagsLoaded){ box.append(mark("card","בחרו בניטור כדי לטעון את הנתונים.")); return; }
4428
  drawScoringRules(box);
4429
  if(flagsError){ const card=mark("card",""); card.append(mark("","לא ניתן לטעון את הדיווחים","h2"),mark("",flagsError,"p")); box.append(card); return; }
4430
- if(CALIBRATIONS.some(c=>c.status!=="rejected"&&!(c.evidence||{}).dismissed)){
 
4431
  const list=mark("card",""); list.append(mark("","הצעות כיול","h2"));
4432
- for(const c of CALIBRATIONS.filter(c=>c.status!=="rejected"&&!(c.evidence||{}).dismissed)){
4433
  const row=mark("flag-review",""), title=mark("",`${phoneName(c.expected)} → ${phoneName(c.heard)} · ${c.status==="applied"?"פעיל":"טיוטה"}`,"b");
4434
  const floor=document.createElement("input"); floor.type="number"; floor.min=0; floor.max=100; floor.value=c.floor; floor.title="ציון מינימום כשמתקיים הבלבול";
4435
  const scope=document.createElement("select"); for(const [value,label] of [["global","כל המשפטים"],["phrase","משפט מסוים"]]){ const o=document.createElement("option"); o.value=value; o.textContent=label; scope.append(o); } scope.value=c.scope||"global";
@@ -4447,7 +4448,7 @@ function drawFlags(){
4447
  const table=mark("flag-patterns","","table"), head=document.createElement("tr"); for(const x of ["משפט וצמד","תלמידים","ניסיונות","שיעור מהמתרגלים","פעולה"]) head.append(mark("",x,"th")); table.append(head);
4448
  for(const p of frequent){
4449
  const row=document.createElement("tr"), label=`${p.phrase} · ${phoneName(p.expected)} → ${phoneName(p.heard)}`; for(const x of [label,p.students,p.attempts,`${Math.round(p.student_rate*100)}%`]) row.append(mark("",x,"td"));
4450
- const cell=document.createElement("td"), exists=CALIBRATIONS.some(c=>c.expected===p.expected&&c.heard===p.heard&&c.status!=="rejected"), propose=mark("btn",exists?"כבר קיימת הצעה":"יצירת טיוטה לבדיקה","button"); propose.disabled=exists;
4451
  propose.onclick=async()=>{ propose.disabled=true; try{ const evidence={source:"student_attempts",attempts:p.attempts,students:p.students,student_rate:p.student_rate,phrases:[p.phrase],average_score:p.average_score}; const res=await api("/api/calibrations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expected:p.expected,heard:p.heard,evidence})}), data=await res.json().catch(()=>({})); if(!res.ok) throw new Error(data.detail||res.status); flagsLoaded=false; await loadFlags(); drawManage(); }catch(err){ alert("יצירת ההצעה נכשלה: "+err.message); propose.disabled=false; } }; cell.append(propose); row.append(cell); table.append(row);
4452
  }
4453
  card.append(table); box.append(card);
 
4427
  if(!flagsLoaded){ box.append(mark("card","בחרו בניטור כדי לטעון את הנתונים.")); return; }
4428
  drawScoringRules(box);
4429
  if(flagsError){ const card=mark("card",""); card.append(mark("","לא ניתן לטעון את הדיווחים","h2"),mark("",flagsError,"p")); box.append(card); return; }
4430
+ const visibleCalibration=c=>c.status!=="rejected"&&!(c.evidence||{}).dismissed;
4431
+ if(CALIBRATIONS.some(visibleCalibration)){
4432
  const list=mark("card",""); list.append(mark("","הצעות כיול","h2"));
4433
+ for(const c of CALIBRATIONS.filter(visibleCalibration)){
4434
  const row=mark("flag-review",""), title=mark("",`${phoneName(c.expected)} → ${phoneName(c.heard)} · ${c.status==="applied"?"פעיל":"טיוטה"}`,"b");
4435
  const floor=document.createElement("input"); floor.type="number"; floor.min=0; floor.max=100; floor.value=c.floor; floor.title="ציון מינימום כשמתקיים הבלבול";
4436
  const scope=document.createElement("select"); for(const [value,label] of [["global","כל המשפטים"],["phrase","משפט מסוים"]]){ const o=document.createElement("option"); o.value=value; o.textContent=label; scope.append(o); } scope.value=c.scope||"global";
 
4448
  const table=mark("flag-patterns","","table"), head=document.createElement("tr"); for(const x of ["משפט וצמד","תלמידים","ניסיונות","שיעור מהמתרגלים","פעולה"]) head.append(mark("",x,"th")); table.append(head);
4449
  for(const p of frequent){
4450
  const row=document.createElement("tr"), label=`${p.phrase} · ${phoneName(p.expected)} → ${phoneName(p.heard)}`; for(const x of [label,p.students,p.attempts,`${Math.round(p.student_rate*100)}%`]) row.append(mark("",x,"td"));
4451
+ const cell=document.createElement("td"), exists=CALIBRATIONS.some(c=>c.expected===p.expected&&c.heard===p.heard&&visibleCalibration(c)), propose=mark("btn",exists?"כבר קיימת הצעה":"יצירת טיוטה לבדיקה","button"); propose.disabled=exists;
4452
  propose.onclick=async()=>{ propose.disabled=true; try{ const evidence={source:"student_attempts",attempts:p.attempts,students:p.students,student_rate:p.student_rate,phrases:[p.phrase],average_score:p.average_score}; const res=await api("/api/calibrations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expected:p.expected,heard:p.heard,evidence})}), data=await res.json().catch(()=>({})); if(!res.ok) throw new Error(data.detail||res.status); flagsLoaded=false; await loadFlags(); drawManage(); }catch(err){ alert("יצירת ההצעה נכשלה: "+err.message); propose.disabled=false; } }; cell.append(propose); row.append(cell); table.append(row);
4453
  }
4454
  card.append(table); box.append(card);