feat: add learning objective targets
This commit is contained in:
32 files changed
+2396
-448
No files matched your search
+14
-18
@@ -50,7 +50,7 @@ pub struct Payload {
|
||||
pub form: FormInfo,
|
||||
/// Counts and sums, so a template does not have to derive them.
|
||||
pub totals: Totals,
|
||||
/// Learning objectives referenced by the printed items, by id.
|
||||
/// Learning objectives and targets referenced by the printed items, by id.
|
||||
#[serde(skip_serializing_if = "BTreeMap::is_empty")]
|
||||
pub objectives: BTreeMap<String, Objective>,
|
||||
/// Shared stimuli, by id. Populated when the render config says stimuli are
|
||||
@@ -268,9 +268,9 @@ pub struct Question {
|
||||
/// letter. Omitted unless the config reveals the key.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub credit_overrides: Option<BTreeMap<String, f64>>,
|
||||
/// Learning objective ids.
|
||||
/// Learning target ids.
|
||||
#[serde(skip_serializing_if = "Vec::is_empty")]
|
||||
pub learning_objectives: Vec<String>,
|
||||
pub learning_targets: Vec<String>,
|
||||
/// Topic tags.
|
||||
#[serde(skip_serializing_if = "Vec::is_empty")]
|
||||
pub topics: Vec<String>,
|
||||
@@ -386,10 +386,10 @@ pub fn build(
|
||||
.or_insert(0) += 1;
|
||||
}
|
||||
|
||||
let objectives = if placement.learning_objectives.is_empty() {
|
||||
item.learning_objectives.clone()
|
||||
let objectives = if placement.learning_targets.is_empty() {
|
||||
item.learning_targets.clone()
|
||||
} else {
|
||||
placement.learning_objectives.clone()
|
||||
placement.learning_targets.clone()
|
||||
};
|
||||
if config.fields.objectives {
|
||||
objective_ids.extend(objectives.iter().cloned());
|
||||
@@ -467,7 +467,7 @@ pub fn build(
|
||||
options,
|
||||
key,
|
||||
credit_overrides,
|
||||
learning_objectives: if config.fields.objectives {
|
||||
learning_targets: if config.fields.objectives {
|
||||
objectives
|
||||
} else {
|
||||
Vec::new()
|
||||
@@ -501,14 +501,10 @@ pub fn build(
|
||||
let objectives = objective_ids
|
||||
.into_iter()
|
||||
.filter_map(|id| {
|
||||
course.learning_objectives.get(&id).map(|o| {
|
||||
(
|
||||
id,
|
||||
Objective {
|
||||
text: markup::to_typst(&o.text),
|
||||
unit: o.unit.clone(),
|
||||
},
|
||||
)
|
||||
(course.is_objective(&id) || course.is_target(&id)).then(|| {
|
||||
let text = markup::to_typst(&course.text_for(&id));
|
||||
let unit = course.objective_unit(&id).map(str::to_string);
|
||||
(id, Objective { text, unit })
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
@@ -960,12 +956,12 @@ fn question_value(question: &Question, config: &RenderConfig) -> Value {
|
||||
}),
|
||||
);
|
||||
|
||||
if !question.learning_objectives.is_empty() {
|
||||
if !question.learning_targets.is_empty() {
|
||||
root.insert(
|
||||
"learning-objectives",
|
||||
"learning-targets",
|
||||
Value::Array(
|
||||
question
|
||||
.learning_objectives
|
||||
.learning_targets
|
||||
.iter()
|
||||
.map(|s| Value::str(s.as_str()))
|
||||
.collect(),
|
||||
|
||||
Reference in new issue
Block a user