fix: exam report targets and objectives
Pipeline / check (pull_request) Successful in 2m43s
Pipeline / docs (pull_request) Skipped
Pipeline / nightly (pull_request) Skipped
Pipeline / release (pull_request) Skipped

This commit is contained in:
alexm committed 2026-09-22 00:39:22 -04:00
1 parent cfe8a3216c
commit d3f21e913b
5 files changed
+233 -131

No files matched your search

+45 -44
View File
@@ -145,56 +145,43 @@ pub fn student(
}
// --- objectives
if opts.objectives && !summary.objectives.is_empty() {
//
// Objectives only. A target row would rest on one question and could only
// ever read "not enough questions to say", so a mixed table buried the few
// real classifications among dozens of non-statements. The targets appear
// where they can be acted on instead: under each lecture in "what to
// revise", and beside each missed question.
if opts.objectives && summary.objectives.iter().any(|o| o.tier == Tier::Objective) {
out.push_str("## What this exam says about each learning objective\n\n");
out.push_str("| | Objective | You | Class | Items |\n|:--|:--|--:|--:|--:|\n");
for o in &summary.objectives {
let you = format!("{:.0}%", o.rate * 100.0);
if o.tier == Tier::Objective {
// The classification, over every question that touched the
// objective.
let scope = if o.targets_total > 0 {
format!(
"{} ({} of {} targets tested)",
escape_pipes(&o.text),
o.targets_seen,
o.targets_total
)
} else {
escape_pipes(&o.text)
};
out.push_str(&format!(
"| {} | **{}** | {} | {:.0}% | {} |\n",
o.status.symbol(),
scope,
you,
o.cohort_rate * 100.0,
o.n_items
));
} else {
// A target row is evidence for the objective above it, so it
// carries no symbol: one question does not classify anything,
// and printing "✗" against one question invites exactly that
// reading.
out.push_str(&format!(
"| | ⤷ {} | {} | {:.0}% | {} |\n",
for o in summary
.objectives
.iter()
.filter(|o| o.tier == Tier::Objective)
{
// How much of the objective this exam reached, which is the scope of
// the claim the row makes.
let scope = if o.targets_total > 0 {
format!(
"{} ({} of {} targets tested)",
escape_pipes(&o.text),
you,
o.cohort_rate * 100.0,
o.n_items
));
}
o.targets_seen,
o.targets_total
)
} else {
escape_pipes(&o.text)
};
out.push_str(&format!(
"| {} | {} | {:.0}% | {:.0}% | {} |\n",
o.status.symbol(),
scope,
o.rate * 100.0,
o.cohort_rate * 100.0,
o.n_items
));
}
out.push('\n');
out.push_str("✓ meeting · ~ developing · ✗ not yet · ? too few questions to tell\n\n");
if summary.objectives.iter().any(|o| o.tier == Tier::Target) {
out.push_str(
"Bold rows are the learning objectives. Indented rows are the learning targets \
inside each one, which is what individual questions were written against: \
they show where the marks went, and a single indented row is one question \
rather than a verdict.\n\n",
);
}
// The "too few questions" cases are an honest caveat about the exam, and
// saying so protects the student from over-reading a single data point.
@@ -319,6 +306,20 @@ pub fn student(
String::new()
};
out.push_str(&format!("**Question {}**{partial}\n\n", m.number));
// Both tiers: the target says what this question asked, the
// objective says which row of the table above it counted toward.
for target in &m.learning_targets {
let objective = course.objective_for(target);
if objective == target.as_str() {
out.push_str(&format!("Asked you to: {}\n\n", course.text_for(target)));
} else {
out.push_str(&format!(
"Asked you to: {} \nCounts toward: {}\n\n",
course.text_for(target),
course.text_for(objective)
));
}
}
if let Some(text) = &m.feedback {
out.push_str(&format!("{text}\n\n"));
} else if let Some(misconception) = &m.misconception {