feat: implement reports

This commit is contained in:
2026-09-19 20:06:41 -04:00
parent 6ae993d393
commit 994e9065e8
28 changed files with 7082 additions and 63 deletions
+43 -1
View File
@@ -43,11 +43,25 @@ pub enum Variant {
Key,
/// A bubble sheet matching the form.
AnswerSheet,
/// One student's diagnostic, which carries no questions.
StudentReport,
/// The instructor's class diagnostic.
CohortReport,
}
impl Variant {
/// Every variant, in the order `export` writes them.
pub const ALL: [Variant; 3] = [Variant::Exam, Variant::Key, Variant::AnswerSheet];
pub const ALL: [Variant; 5] = [
Variant::Exam,
Variant::Key,
Variant::AnswerSheet,
Variant::StudentReport,
Variant::CohortReport,
];
/// The variants `export typst` produces. A report is not built from an
/// assessment record alone, so `export typst` must not default to it.
pub const EXAM: [Variant; 3] = [Variant::Exam, Variant::Key, Variant::AnswerSheet];
/// The token used on the command line, in config keys, and in file names.
pub fn as_str(self) -> &'static str {
@@ -55,6 +69,8 @@ impl Variant {
Variant::Exam => "exam",
Variant::Key => "key",
Variant::AnswerSheet => "answer-sheet",
Variant::StudentReport => "student-report",
Variant::CohortReport => "cohort-report",
}
}
@@ -103,6 +119,8 @@ impl Variant {
Variant::Exam => "",
Variant::Key => "-key",
Variant::AnswerSheet => "-answer-sheet",
Variant::StudentReport => "-student",
Variant::CohortReport => "-cohort",
}
}
}
@@ -422,6 +440,30 @@ impl RenderConfig {
calibration: false,
};
}
Variant::StudentReport => {
// Belt and braces. The student payload is built by
// `typst::diagnostic`, which has no question text to reveal in the
// first place; this says so in the one place someone would look.
config.reveal = Reveal::Nothing;
config.stimulus = StimulusMode::Omit;
config.fields = Fields {
uid: false,
title: false,
points: true,
level: true,
objectives: true,
topics: false,
assets: false,
source_letters: false,
design: false,
calibration: false,
};
}
Variant::CohortReport => {
config.reveal = Reveal::Everything;
config.stimulus = StimulusMode::Omit;
config.fields.calibration = true;
}
}
config
}