Varied question openers, readable rationales, plain practice score
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 30s

- Stems no longer all open the same way: the writing rules, batch prompt and
  planner ask for varied openings (age openings stay part of the mix), and when
  one opener covers more than a quarter of a quiz the excess stems have only
  their opening reworded, keeping every number, before the check.
- Rationales are asked for as Markdown (a bold key point, then short bullets);
  older one-paragraph rationales are laid out the same way on display.
- The practice score in the quiz header is a plain "x/y correct", with no
  percentage or colour.
- Fix a flaky assertion: the mock's answer-key fix is a no-op when the shuffle
  already put the answer in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-11-16 12:05:46 -07:00
parent 10be5c39da
commit 517278be71
15 changed files with 382 additions and 24 deletions

View file

@ -4,6 +4,7 @@ import { isFullyCorrect, letterGrade, optionLetter, parseNumericAnswer, scoreQue
import type { AnswerState, SnapshotQuestion } from '@/lib/types';
import { cx, formatDuration, formatMinutes, plural, useHotkeys, useLatest } from '@/lib/util';
import { Markdown } from '@/ui/Markdown';
import { formatRationale } from '@shared/rationale';
import { Badge, Button, Dialog, IconButton, Input, ProgressBar, Segmented, useConfirm } from '@/ui';
import { ExplainSideContext } from './Explain';
@ -345,14 +346,9 @@ export function QuizRunner(p: RunnerProps) {
<div className="text-xs text-ink-3">{p.mode === 'exam' ? 'Exam' : 'Practice'}</div>
</div>
{live && (
<div
className={cx('num flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[13px] font-semibold', { good: 'bg-good-soft text-good', warn: 'bg-warn-soft text-warn', bad: 'bg-bad-soft text-bad' }[gradeToneFor(live.percent)])}
aria-label={`Score so far: ${fmtPoints(live.points)} of ${live.n} correct, ${live.percent} percent`}
>
<span className="hidden sm:inline">
{fmtPoints(live.points)}/{live.n} correct ·
</span>
{live.percent}%
<div className="num flex items-center rounded-full px-2.5 py-1 text-[13px] font-medium text-ink-2" aria-label={`Score so far: ${fmtPoints(live.points)} of ${live.n} correct`}>
{fmtPoints(live.points)}/{live.n}
<span className="hidden sm:inline">&nbsp;correct</span>
</div>
)}
{/* The clock is a timed-exam feature; untimed sessions track time quietly for the results. */}
@ -402,7 +398,7 @@ export function QuizRunner(p: RunnerProps) {
{question.rationale && (
<div className="rounded-[14px] border border-line bg-surface p-4">
<div className="eyebrow mb-1.5">Rationale</div>
<Markdown className="text-[15px]">{question.rationale}</Markdown>
<Markdown className="text-[15px]">{formatRationale(question.rationale)}</Markdown>
</div>
)}
<ExplainSideContext.Provider value={explainSide}>{p.renderExtra?.(question, answerTexts(question, selected))}</ExplainSideContext.Provider>
@ -708,7 +704,7 @@ export function QuizResults(p: ResultsProps) {
{r.q.rationale && (
<div className="mt-3.5 rounded-xl bg-sunken px-4 py-3">
<div className="eyebrow mb-1">Rationale</div>
<Markdown className="text-[14.5px]">{r.q.rationale}</Markdown>
<Markdown className="text-[14.5px]">{formatRationale(r.q.rationale)}</Markdown>
</div>
)}
{p.renderExtra && (