The writers score each other's scripts; the best becomes head writer

This commit is contained in:
gator 2026-09-20 05:21:24 +00:00
parent 31bb7fbfcc
commit fdef88b1eb

View file

@ -246,7 +246,7 @@
return d.state === "writing" || (s && !/^(drawn|failed)/.test(s));
}
function busyRun() {
return RUN && /^(writing|reviewing|revising)$/.test(String(RUN.stage || ""));
return RUN && /^(writing|reviewing|revising|judging)$/.test(String(RUN.stage || ""));
}
// Work happens in the worker's memory and does not survive a deploy, so a
// flag saying "in progress" is only believed while it is recent.
@ -338,6 +338,30 @@
return bits.join(" · ");
}
// THE WRITERS SCORE EACH OTHER. Blind, against the checklist in the guide;
// nobody marks their own script; the winner becomes head writer.
function contestHtml() {
var ready = DRAFTS.filter(function (d) { return /^ready/.test(String(d.state)) && Number(d.iteration || 1) === Number(RUN.iteration || 1); });
if (ready.length < 2) return "";
var c = RUN.contest, label = {};
DRAFTS.forEach(function (d) { label[d.writer] = d.label || d.writer; });
var btn = RUN.stage === "judging"
? '<span class="busy">The writers are reading and scoring each other’s scripts… a few minutes.</span>'
: '<button type="button" class="btn' + (c ? '' : ' primary') + '" data-judge="1">'
+ (c ? 'Score them again' : 'Have the writers score each other’s scripts') + ' &middot; about $' + (0.12 * ready.length).toFixed(2) + '</button>';
var table = "";
if (c && (c.ranked || []).length) {
table = '<table style="border-collapse:collapse;font-size:13px;margin:8px 0"><tr><th style="text-align:left;padding:3px 10px 3px 0">script</th><th style="padding:3px 10px">score</th><th style="text-align:left;padding:3px 0">what the other writers said</th></tr>'
+ c.ranked.map(function (r, i) {
var n = (r.notes || [])[0] || {};
return '<tr style="border-top:1px solid var(--line)"><td style="padding:5px 10px 5px 0;white-space:nowrap">' + (i === 0 ? '★ ' : '') + '<b>' + esc(label[r.writer] || r.writer)
+ '</b></td><td style="padding:5px 10px;text-align:center"><b>' + esc(r.score) + '</b><br><span class="dir">' + esc((r.marks || []).join(", ")) + '</span></td><td style="padding:5px 0"><span style="color:#1f7a3a">+</span> '
+ esc(n.best || "") + '<br><span style="color:#b4531f">−</span> ' + esc(n.worst || "") + '</td></tr>'; }).join("")
+ '</table><p class="cont">The highest scoring script’s writer is now the head writer (★). You can still choose another.</p>';
}
return '<div class="guide" style="margin-bottom:12px"><h4>Which script is best?</h4>' + table + btn + '</div>';
}
// One more writer on this run: same book, same notes, nobody else pays again.
var ALLWRITERS = null;
function addWriterHtml() {
@ -891,7 +915,7 @@
shots.forEach(function (s) { body += shotHtml(s, voice) + insertHtml(s.id); });
DRAFTNOW = draft;
return head + guideHtml(meta) + probs + '<div class="bar">' + barHtml(meta) + '</div>'
return head + contestHtml() + guideHtml(meta) + probs + '<div class="bar">' + barHtml(meta) + '</div>'
+ '<div id="reelhost">' + reelHtml() + '</div>'
+ spineHtml() + cutsHtml(meta) + reviewsHtml(meta) + wholeHtml() + castHtml + propsHtml() + body;
}
@ -1527,6 +1551,12 @@
}
return;
}
if ((el = hit("data-judge"))) {
el.disabled = true;
r = await act("judge_scripts", { run_id: runId });
if (r) { showMsg("msg", "Every writer is reading all " + r.scripts + " scripts, without knowing whose is whose. About $" + r.usd + ".", "ok"); await load(); }
return;
}
if ((el = hit("data-review"))) {
el.disabled = true;
r = await act("start_review", { run_id: runId }); if (r) await refresh(); return;