feat: add more report cli options
Pipeline / check (pull_request) Failing after 21s
Pipeline / docs (pull_request) Skipped
Pipeline / nightly (pull_request) Skipped
Pipeline / release (pull_request) Skipped

This commit is contained in:
2026-09-20 10:54:39 -04:00
parent beec860a2c
commit 9755417899
4 changed files with 188 additions and 18 deletions
+54 -14
View File
@@ -169,10 +169,16 @@ fn extra_value(config: &RenderConfig) -> Value {
/// One student's diagnostic as a Typst value.
///
/// `config.student_sections` decides which of `levels`, `objectives`,
/// `strengths`, `focus`, `dropped-questions`, `review-lectures`, and `study`
/// are populated; a section turned off is emitted as an empty array rather
/// than left out of the dictionary, so a template need not guard against a
/// missing key.
///
/// # Arguments
///
/// * `diagnostic` - the assembled diagnostic.
/// * `config` - the render config, for markup handling.
/// * `config` - the render config, for markup handling and section toggles.
///
/// # Returns
///
@@ -206,11 +212,15 @@ pub fn student_value(diagnostic: &StudentDiagnostic, config: &RenderConfig) -> V
out.insert("standing", value);
}
let levels = if config.student_sections.levels {
diagnostic.levels.as_slice()
} else {
&[]
};
out.insert(
"levels",
Value::Array(
diagnostic
.levels
levels
.iter()
.map(|level| {
let mut value = Value::dict();
@@ -227,11 +237,15 @@ pub fn student_value(diagnostic: &StudentDiagnostic, config: &RenderConfig) -> V
),
);
let objectives = if config.student_sections.objectives {
diagnostic.objectives.as_slice()
} else {
&[]
};
out.insert(
"objectives",
Value::Array(
diagnostic
.objectives
objectives
.iter()
.map(|objective| {
let mut value = Value::dict();
@@ -278,8 +292,22 @@ pub fn student_value(diagnostic: &StudentDiagnostic, config: &RenderConfig) -> V
.collect(),
)
};
out.insert("strengths", objective_refs(&diagnostic.strengths));
out.insert("focus", objective_refs(&diagnostic.focus));
out.insert(
"strengths",
objective_refs(if config.student_sections.strengths {
&diagnostic.strengths
} else {
&[]
}),
);
out.insert(
"focus",
objective_refs(if config.student_sections.focus {
&diagnostic.focus
} else {
&[]
}),
);
out.insert(
"questions",
@@ -349,11 +377,15 @@ pub fn student_value(diagnostic: &StudentDiagnostic, config: &RenderConfig) -> V
),
);
let dropped_questions = if config.student_sections.dropped_questions {
diagnostic.dropped_questions.as_slice()
} else {
&[]
};
out.insert(
"dropped-questions",
Value::Array(
diagnostic
.dropped_questions
dropped_questions
.iter()
.map(|dropped| {
let mut value = Value::dict();
@@ -365,11 +397,15 @@ pub fn student_value(diagnostic: &StudentDiagnostic, config: &RenderConfig) -> V
),
);
let review_lectures = if config.student_sections.review_lectures {
diagnostic.review_lectures.as_slice()
} else {
&[]
};
out.insert(
"review-lectures",
Value::Array(
diagnostic
.review_lectures
review_lectures
.iter()
.map(|lecture| {
let mut value = Value::dict();
@@ -414,11 +450,15 @@ pub fn student_value(diagnostic: &StudentDiagnostic, config: &RenderConfig) -> V
),
);
let study = if config.student_sections.study {
diagnostic.study.as_slice()
} else {
&[]
};
out.insert(
"study",
Value::Array(
diagnostic
.study
study
.iter()
.map(|group| study_value(group, content))
.collect(),
@@ -1196,4 +1236,4 @@ mod tests {
assert!(text.contains("reliability"));
assert!(!text.contains("stem"));
}
}
}