Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (claude): fall back to answers[] for expected display when a question has no scalar expected

Adam Eivyaaff9bac77f2
diff --git a/client/src/components/meatspace/post/DrillQuestionReview.jsx b/client/src/components/meatspace/post/DrillQuestionReview.jsx
index e6ba59e481..3f047ee88b 100644
--- a/client/src/components/meatspace/post/DrillQuestionReview.jsx
+++ b/client/src/components/meatspace/post/DrillQuestionReview.jsx
@@ -73,6 +73,22 @@ function formatGenericValue(type, value) {
return String(value);
}
+// memory-fill-blank (schema-valid, generated by generateFillBlank, but not
+// yet wired into the interactive POST session drill picker — see
+// POST_UNSUPPORTED_DRILL_TYPES in constants.js) carries acceptable answers as
+// `answers[]` objects (`{ index, word, element }`) instead of a scalar
+// `expected`. Fall back to those so this generic view never just shows "—"
+// for every row if that type is ever produced, without conflating this
+// display-only fallback with the separate, pre-existing scoring gap for that
+// type in usePostSession.js (out of scope here — see PLAN.md).
+function expectedForDisplay(q) {
+ if (q.expected !== null && q.expected !== undefined && q.expected !== '') return q.expected;
+ if (Array.isArray(q.answers) && q.answers.length) {
+ return q.answers.map((a) => (a && typeof a === 'object' ? a.word : a)).filter(Boolean).join(' / ');
+ }
+ return q.expected;
+}
+
function GenericReview({ questions, missed, type }) {
return (
<div>
@@ -98,7 +114,7 @@ function GenericReview({ questions, missed, type }) {
? <span className="italic text-gray-500">skipped</span>
: formatGenericValue(type, q.answered)}
</td>
- <td className="py-1 pr-2 font-mono text-port-success">{formatGenericValue(type, q.expected)}</td>
+ <td className="py-1 pr-2 font-mono text-port-success">{formatGenericValue(type, expectedForDisplay(q))}</td>
<td className="py-1 pr-2 text-center"><ResultIcon correct={q.correct} unanswered={unanswered} /></td>
<td className="py-1 pl-2 text-right text-gray-400 font-mono">{fmtMs(q.responseMs)}</td>
</tr>
diff --git a/client/src/components/meatspace/post/DrillQuestionReview.test.jsx b/client/src/components/meatspace/post/DrillQuestionReview.test.jsx
index 9a046757c4..3bcc56e129 100644
--- a/client/src/components/meatspace/post/DrillQuestionReview.test.jsx
+++ b/client/src/components/meatspace/post/DrillQuestionReview.test.jsx
@@ -45,6 +45,23 @@ describe('DrillQuestionReview — generic (math/memory/fallback)', () => {
expect(table.getByText('41')).toBeInTheDocument();
});
+ it('falls back to answers[] for the expected column when a question has no scalar `expected` (e.g. memory-fill-blank)', () => {
+ const { container } = render(
+ <DrillQuestionReview
+ type="memory-fill-blank"
+ questions={[{
+ prompt: 'The ____ ____ jumps',
+ answered: 'quick brown',
+ correct: false,
+ responseMs: 1200,
+ answers: [{ index: 1, word: 'quick' }, { index: 2, word: 'fox' }],
+ }]}
+ />
+ );
+ const table = within(container.querySelector('table'));
+ expect(table.getByText('quick / fox')).toBeInTheDocument();
+ });
+
it('formats mental-rotation option indices as human-readable option numbers', () => {
render(
<DrillQuestionReview