feat: add learning objective targets
Pipeline / check (pull_request) Failing after 3m25s
Pipeline / docs (pull_request) Skipped
Pipeline / nightly (pull_request) Skipped
Pipeline / release (pull_request) Skipped

This commit is contained in:
alexm committed 2026-09-21 14:02:34 -04:00
1 parent 9755417899
commit 8ec48fb185
32 files changed
+2396 -448

No files matched your search

+67 -22
View File
@@ -36,7 +36,7 @@ use crate::course::CourseFile;
use crate::date::Date;
use crate::irt::Fit;
use crate::students::{Cohort, Mastery, StudentSummary};
use crate::taxonomy::Level;
use crate::taxonomy::{Level, Tier};
/// What to include in a student report.
#[derive(Debug, Clone)]
@@ -150,24 +150,58 @@ pub fn student(
out.push_str("| | Objective | You | Class | Items |\n|:--|:--|--:|--:|--:|\n");
for o in &summary.objectives {
let you = format!("{:.0}%", o.rate * 100.0);
out.push_str(&format!(
"| {} | {} | {} | {:.0}% | {} |\n",
o.status.symbol(),
escape_pipes(&o.text),
you,
o.cohort_rate * 100.0,
o.n_items
));
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",
escape_pipes(&o.text),
you,
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.
let thin: Vec<&str> = summary
.objectives
.iter()
.filter(|o| o.status == Mastery::NotEnoughEvidence)
.filter(|o| o.tier == Tier::Objective && o.status == Mastery::NotEnoughEvidence)
.map(|o| o.text.as_str())
.collect();
if !thin.is_empty() {
@@ -236,7 +270,7 @@ pub fn student(
out.push_str("## Where to put your time\n\n");
out.push_str("In this order:\n\n");
for (i, id) in summary.focus.iter().take(4).enumerate() {
let text = course.objective_text(id);
let text = course.text_for(id);
out.push_str(&format!("{}. {}\n", i + 1, text));
}
out.push('\n');
@@ -250,10 +284,7 @@ pub fn student(
.map(|(id, _)| id.as_str())
.collect();
if !class_gaps.is_empty() {
let texts: Vec<String> = class_gaps
.iter()
.map(|id| course.objective_text(id))
.collect();
let texts: Vec<String> = class_gaps.iter().map(|id| course.text_for(id)).collect();
let refs: Vec<&str> = texts.iter().map(|s| s.as_str()).collect();
out.push_str(&format!(
"Most of the class also struggled with {}, so expect it to come back in class. \
@@ -268,7 +299,7 @@ pub fn student(
.strengths
.iter()
.take(4)
.map(|id| course.objective_text(id))
.map(|id| course.text_for(id))
.collect();
let refs: Vec<&str> = texts.iter().map(|s| s.as_str()).collect();
out.push_str(&format!("You have clearly got {}.\n\n", list(&refs)));
@@ -549,7 +580,7 @@ pub fn cohort(
for (id, rate) in &cohort.class_gaps {
out.push_str(&format!(
"| {} | {:.0}% |\n",
escape_pipes(&course.objective_text(id)),
escape_pipes(&course.text_for(id)),
rate * 100.0
));
}
@@ -576,7 +607,7 @@ pub fn cohort(
out.push('\n');
if let Some(bp) = &record.blueprint {
let drift = crate::select::check_blueprint(record);
let drift = crate::select::check_blueprint(record, course);
if !drift.is_empty() {
out.push_str("Blueprint drift:\n\n");
for d in &drift {
@@ -956,6 +987,10 @@ pub fn write_all_students(
/// Per-objective class rates as a compact table, for pasting into a syllabus
/// review or a curriculum committee document.
///
/// Objectives only. A committee document listing three hundred learning targets
/// is not read, and the target rates are the wrong number to put in front of one
/// anyway: each rests on one or two questions.
///
/// # Arguments
///
/// * `cohort` - the class.
@@ -965,7 +1000,7 @@ pub fn write_all_students(
///
/// A Markdown table.
pub fn objective_summary(cohort: &Cohort, course: &CourseFile) -> String {
let mut out = String::from("| Objective | Class rate |\n|:--|--:|\n");
let mut out = String::from("| Objective | Class rate | Items |\n|:--|--:|--:|\n");
let mut rows: Vec<(&String, &f64)> = cohort.objective_rates.iter().collect();
rows.sort_by(|a, b| {
a.1.partial_cmp(b.1)
@@ -973,10 +1008,20 @@ pub fn objective_summary(cohort: &Cohort, course: &CourseFile) -> String {
.then_with(|| a.0.cmp(b.0))
});
for (id, rate) in rows {
// Items behind the rate, because a rate without a denominator is what
// makes a committee table misleading.
let n = cohort
.students
.iter()
.flat_map(|s| s.objectives.iter())
.find(|o| &o.id == id)
.map(|o| o.n_items)
.unwrap_or(0);
out.push_str(&format!(
"| {} | {:.0}% |\n",
escape_pipes(&course.objective_text(id)),
rate * 100.0
"| {} | {:.0}% | {} |\n",
escape_pipes(&course.text_for(id)),
rate * 100.0,
n
));
}
out