feat: improve dropped question support

This commit is contained in:
alexm committed 2026-09-20 00:41:26 -04:00
1 parent ba84c4d82a
commit cea03048b8
18 files changed
+302 -86

No files matched your search

+56
View File
@@ -281,6 +281,48 @@ pub struct Placement {
/// Set when an item was dropped from scoring after administration.
#[serde(default, skip_serializing_if = "is_false")]
pub dropped: bool,
/// How the drop was applied on the grading platform.
///
/// Two ways to throw a question out, and they produce different
/// percentages. [`DropStyle::Removed`] takes the item out of the numerator
/// and the denominator: a student with 27 of 35 scores 77.1%.
/// [`DropStyle::FullCredit`] is what you do when the grade of record lives
/// somewhere else and the question cannot be removed from it: every option
/// is keyed, everyone earns the point, and the same student scores 28 of 36,
/// or 77.8%.
///
/// Defaults to [`DropStyle::Removed`], which is what `dropped: true` meant
/// before this field existed. Set it to `full_credit` when you have credited
/// every option in the platform, so that the report agrees with the grade the
/// student can see.
///
/// Either way the item is out of the item statistics, the objective
/// evidence, and the IRT fit: an item everyone got right has no variance to
/// contribute.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub dropped_as: Option<DropStyle>,
}
/// How a dropped item was handled on the grading platform.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum DropStyle {
/// Taken out of the numerator and the denominator.
Removed,
/// Every option credited, so the item stays in both.
FullCredit,
}
impl Placement {
/// Whether this placement was dropped by crediting every option.
///
/// # Returns
///
/// `true` only when the item is dropped *and* the drop was applied as full
/// credit, so the item still belongs in the points of record.
pub fn dropped_with_credit(&self) -> bool {
self.dropped && self.dropped_as == Some(DropStyle::FullCredit)
}
}
impl AssessmentFile {
@@ -451,6 +493,20 @@ impl AssessmentFile {
));
}
}
if p.dropped_as.is_some() && !p.dropped {
issues.push(format!(
"question {}: `dropped_as` is set but `dropped` is not, so nothing is dropped",
p.number
));
}
if p.dropped && !p.credit_overrides.is_empty() {
issues.push(format!(
"question {}: dropped and carrying credit overrides. Pick one: an override \
rescores an option, a drop removes the question",
p.number
));
}
}
let mut form_ids: Vec<&str> = Vec::new();