chore: add dropped question to reports

This commit is contained in:
2026-09-19 23:15:31 -04:00
parent 92c8a8fc75
commit ba84c4d82a
4 changed files with 110 additions and 5 deletions
+41 -1
View File
@@ -172,6 +172,12 @@ pub struct StudentDiagnostic {
/// One row per question, with no question in it.
#[serde(skip_serializing_if = "Vec::is_empty")]
pub questions: Vec<QuestionRow>,
/// Questions dropped from scoring, in number order.
///
/// Reported separately from the question rows so the document can say once,
/// in prose, why the denominator is smaller than the paper was.
#[serde(skip_serializing_if = "Vec::is_empty")]
pub dropped_questions: Vec<u32>,
/// Which lectures to go back to, the one that would repay the most time
/// first.
#[serde(skip_serializing_if = "Vec::is_empty")]
@@ -320,6 +326,13 @@ pub struct QuestionRow {
/// Whether it was a bonus question.
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub bonus: bool,
/// Whether it was dropped from scoring after the fact.
///
/// A dropped question still appears in the map, because the student has the
/// paper in front of them and will look for it. What it must not do is
/// appear as an error they made.
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub dropped: bool,
/// Whether the student left it blank.
pub blank: bool,
/// The share of the class that answered it correctly, when comparison is on.
@@ -530,6 +543,14 @@ pub fn student(
Vec::new()
};
let mut dropped_questions: Vec<u32> = rows
.iter()
.filter(|r| r.dropped)
.map(|r| r.item_number)
.collect();
dropped_questions.sort_unstable();
dropped_questions.dedup();
// Built from the response rows rather than from `questions`, so a report with
// `--no-questions` still says where to go back to; it just does not name the
// question numbers.
@@ -573,6 +594,7 @@ pub fn student(
strengths,
focus,
questions,
dropped_questions,
review_lectures,
study,
}
@@ -591,7 +613,10 @@ fn question_row(
opts: &Options,
) -> QuestionRow {
let blank = row.selected.is_empty() && row.eliminated.is_empty();
let missed = row.credit < 0.999;
// A dropped question cannot be missed. Without `counts()` here, a question
// thrown out after the exam still collects per-option feedback explaining an
// error the student is no longer being charged for.
let missed = row.credit < 0.999 && row.counts();
let mut feedback = None;
let mut hint = None;
let mut misconception = None;
@@ -673,6 +698,7 @@ fn question_row(
correct: row.correct,
credit: row.credit,
bonus: row.bonus,
dropped: row.dropped,
blank,
class_rate: opts
.comparison
@@ -926,6 +952,11 @@ pub struct CohortDiagnostic {
pub lectures: Vec<CohortLectureRow>,
/// Per-question statistics.
pub questions: Vec<CohortQuestionRow>,
/// Questions dropped from scoring, which are therefore absent from every
/// table above. Recorded so the report says why rather than leaving a gap in
/// the numbering.
#[serde(skip_serializing_if = "Vec::is_empty")]
pub dropped_questions: Vec<u32>,
/// What to do about each question that raised something.
pub triage: Triage,
/// How the authored expectations did.
@@ -1478,6 +1509,13 @@ pub fn cohort(
.filter_map(|item| questions.iter().find(|q| q.number == item.number).cloned())
.collect();
let mut dropped_questions: Vec<u32> = set
.all_items()
.into_iter()
.filter(|n| set.item_dropped(*n))
.collect();
dropped_questions.sort_unstable();
let default_options = course.policy.options_per_item;
let triage = triage(&questions, threshold, default_options);
let predictions = prediction_summary(analysis);
@@ -1490,6 +1528,7 @@ pub fn cohort(
distribution: distribution(&percents),
grades,
lectures,
dropped_questions,
triage,
predictions,
reliability: ReliabilityRow {
@@ -2193,6 +2232,7 @@ mod tests {
strengths: Vec::new(),
focus: Vec::new(),
questions: Vec::new(),
dropped_questions: Vec::new(),
review_lectures: Vec::new(),
study: Vec::new(),
})