Spaces:
Sleeping
Sleeping
File size: 881 Bytes
161cb23 a1415e8 161cb23 a1415e8 161cb23 a1415e8 161cb23 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import presets from "shared:presets";
import { byId } from "./dom.js";
import { issuesText, scoreWord, toHundred } from "./labels.js";
import { paintLines } from "./stage.js";
const FILENAME = "send_receipt.py";
export async function paintSample(scoreAll) {
const original = presets.find((preset) => preset.filename === FILENAME).before;
const [result] = await scoreAll([original]);
paintLines(byId("sample-code"), {
text: original,
filename: FILENAME,
squiggles: result.squiggles,
enter: false,
});
const points = toHundred(result.score);
const { word, className } = scoreWord(points);
const wordNode = byId("sample-word");
byId("sample-status").textContent = issuesText(result.squiggles.length);
byId("sample-value").textContent = String(points);
wordNode.textContent = word;
wordNode.className = `stage-score-word ${className}`.trim();
}
|