Spaces:
Sleeping
Sleeping
deploy v2 study (40-runs baselines) at /v2/: dual-study backend + static/v2 rater UI; v1 study untouched
Browse files840 unmodified lines8418428438448458468478488498508519 unmodified lines8618628638648658668678 unmodified lines87687787887988088188237 unmodified lines92092192292392492592680 unmodified lines1007100810091010101110121013202 unmodified lines12161217121812191220122112221223122412251226122712281229224 unmodified lines1454145514561457145814591460840 unmodified linesreturn Array.from({length:slotCount},(_,i)=>i);}/* ----- Ratings ----- */function getCaseR(cid){ if(!RATINGS[cid]) RATINGS[cid]={}; return RATINGS[cid]; }function getSlotR(cid, s){ const m = getCaseR(cid); if(!m[s]) m[s]={}; return m[s]; }function setRating(cid, sIdx, qk, score){getSlotR(cid, sIdx)[qk] = score;saveState();updateProgress();if (RATER.submitted_at){9 unmodified linesfor (const c of CASES){const slots = SHUFFLE[c.id] || c.videos.map((_,i)=>i);for (let s=0; s<slots.length; s++){const r = (RATINGS[c.id]||{})[s] || {};for (const qk of qkeys){expected++;if (typeof r[qk]==="number" && r[qk]>=1 && r[qk]<=5) done++;8 unmodified linesconst expected = slots.length * TOTAL_QUESTIONS;let done=0;for (let s=0;s<slots.length;s++){const r = (RATINGS[c.id]||{})[s] || {};done += Object.keys(r).filter(k=>typeof r[k]==="number"&&r[k]>=1&&r[k]<=5).length;}return { done, expected };37 unmodified linesslot: String.fromCharCode(65+slotIdx), slot_index: slotIdx,original_index: origIdx, model: c.videos[origIdx].model,path: c.videos[origIdx].path,ratings: (RATINGS[c.id]||{})[slotIdx] || {},})),};}),80 unmodified linesvideos: slots.map((oi,si)=>({slot:String.fromCharCode(65+si), slot_index:si, original_index:oi,model:c.videos[oi].model, path:c.videos[oi].path,ratings:(RATINGS[c.id]||{})[si]||{},})),};}),202 unmodified linesrow.appendChild(chip);const group = document.createElement("div");group.className = "likert";const cur = getSlotR(c.id, slotIdx)[q.key];for (let s=1; s<=5; s++){const b = document.createElement("button");b.dataset.score = String(s);b.textContent = String(s);if (cur===s) b.classList.add("selected");b.onclick = () => {setRating(c.id, slotIdx, q.key, s);Array.from(group.children).forEach((bb,i)=>bb.classList.toggle("selected", (i+1)===s));};group.appendChild(b);224 unmodified linesif (!isAdmin()) anonymize = true;// Admins see all cases; everyone else gets a deterministic 10-case subset.CASES = selectCasesForRater(ALL_CASES);buildShuffle(CASES); saveState();// wire DOM eventsdocument.getElementById("drawerBtn").onclick = openDrawer;840 unmodified lines8418428438448458468478488498508518528538548558569 unmodified lines8668678688698708718728 unmodified lines88188288388488588688737 unmodified lines92592692792892993093180 unmodified lines1012101310141015101610171018202 unmodified lines12211222122312241225122612271228122912301231123212331234224 unmodified lines14591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484840 unmodified linesreturn Array.from({length:slotCount},(_,i)=>i);}/* ----- Ratings -----* RATINGS is keyed RATINGS[case_id][model][q_key] — by MODEL NAME, exactly* like desktop index.html, so the shared localStorage blob and the* server-recovered state read identically on both pages. (Older mobile code* keyed by slot index; see migrateSlotKeyedRatings for the one-shot fix-up.)*/function getCaseR(cid){ if(!RATINGS[cid]) RATINGS[cid]={}; return RATINGS[cid]; }function getModelR(cid, model){ const m = getCaseR(cid); if(!m[model]) m[model]={}; return m[model]; }function setRating(cid, model, qk, score){getModelR(cid, model)[qk] = score;saveState();updateProgress();if (RATER.submitted_at){9 unmodified linesfor (const c of CASES){const slots = SHUFFLE[c.id] || c.videos.map((_,i)=>i);for (let s=0; s<slots.length; s++){const r = (RATINGS[c.id]||{})[c.videos[slots[s]].model] || {};for (const qk of qkeys){expected++;if (typeof r[qk]==="number" && r[qk]>=1 && r[qk]<=5) done++;8 unmodified linesconst expected = slots.length * TOTAL_QUESTIONS;let done=0;for (let s=0;s<slots.length;s++){const r = (RATINGS[c.id]||{})[c.videos[slots[s]].model] || {};done += Object.keys(r).filter(k=>typeof r[k]==="number"&&r[k]>=1&&r[k]<=5).length;}return { done, expected };37 unmodified linesslot: String.fromCharCode(65+slotIdx), slot_index: slotIdx,original_index: origIdx, model: c.videos[origIdx].model,path: c.videos[origIdx].path,ratings: (RATINGS[c.id]||{})[c.videos[origIdx].model] || {},})),};}),80 unmodified linesvideos: slots.map((oi,si)=>({slot:String.fromCharCode(65+si), slot_index:si, original_index:oi,model:c.videos[oi].model, path:c.videos[oi].path,ratings:(RATINGS[c.id]||{})[c.videos[oi].model]||{},})),};}),202 unmodified linesrow.appendChild(chip);const group = document.createElement("div");group.className = "likert";const cur = getModelR(c.id, v.model)[q.key];for (let s=1; s<=5; s++){const b = document.createElement("button");b.dataset.score = String(s);b.textContent = String(s);if (cur===s) b.classList.add("selected");b.onclick = () => {setRating(c.id, v.model, q.key, s);Array.from(group.children).forEach((bb,i)=>bb.classList.toggle("selected", (i+1)===s));};group.appendChild(b);224 unmodified linesif (!isAdmin()) anonymize = true;// Admins see all cases; everyone else gets a deterministic 10-case subset.CASES = selectCasesForRater(ALL_CASES);buildShuffle(CASES);// One-shot migration: older mobile builds keyed RATINGS by slot index// instead of model name. SHUFFLE is deterministic per (rater, case), so a// numeric slot key maps back to the exact model the rater saw and scored.{let moved = 0;for (const c of CASES) {const m = RATINGS[c.id];if (!m) continue;const slots = SHUFFLE[c.id] || c.videos.map((_,i)=>i);for (const k of Object.keys(m)) {if (!/^\d+$/.test(k)) continue;const model = (c.videos[slots[Number(k)]] || {}).model;if (model && !m[model]) { m[model] = m[k]; moved++; }delete m[k];}}if (moved) console.info(`[user-study] migrated ${moved} slot-keyed rating group(s) to model keys`);}saveState();// wire DOM eventsdocument.getElementById("drawerBtn").onclick = openDrawer;
static/v2/mobile.html+35-11