fix: improve canvas export

This commit is contained in:
2026-08-26 21:24:22 -04:00
parent 4cd33f1768
commit d38d89549c
2 changed files with 418 additions and 42 deletions
+14 -2
View File
@@ -39,12 +39,24 @@ pub(crate) fn export(cli: &Cli, sub: &ExportCommand) -> Result<Outcome> {
let opts = qti::QtiOptions {
form: form.clone(),
include_feedback: !no_feedback,
shuffle_in_canvas: record.assessment.shuffle.unwrap_or(false),
attempts: record.assessment.attempts.unwrap_or(1),
shuffle_in_canvas: record.assessment.shuffle.unwrap_or(true),
// No per-assessment attempts value falls back to unlimited, the
// same default `QtiOptions::default()` carries. Keeping this in
// step with the struct default avoids a record without an
// `attempts:` silently becoming single-attempt here while the
// library considers the default to be unlimited.
attempts: record.assessment.attempts.unwrap_or(-1),
scoring_policy: record
.assessment
.scoring_policy
.unwrap_or(coursebank::assessment::ScoringPolicy::KeepHighest),
// The remaining fields drive `assessment_meta.xml` (quiz type,
// results visibility, correct-answer display, one-question-at-a-
// time, timing, publish state). This command exposes no flags for
// them yet, so take the library defaults: a formative graded quiz
// that lets students review responses and the correct answer, and
// imports unpublished.
..qti::QtiOptions::default()
};
let package = qti::build(&catalog, &record, &opts)?;
let path = out