1
0
Fork 0

Autochecklist: Add support for checklists using multiple <page>s

This commit is contained in:
Benedikt Wolf 2023-03-16 16:57:30 +01:00
parent f05440df49
commit 2305672157

View file

@ -228,37 +228,76 @@ var complete = func(node, wait, from = nil)
foreach (var index; node.getChildren("index")) { foreach (var index; node.getChildren("index")) {
var checklist = checklists_node.getChild("checklist", index.getValue()); var checklist = checklists_node.getChild("checklist", index.getValue());
foreach (var item; checklist.getChildren("item")) { if( size( checklist.getChildren("page") ) > 0 ){
var condition = item.getNode("condition"); foreach( var page; checklist.getChildren("page") ){
if (skipping) { foreach (var item; page.getChildren("item")) {
if (!item.equals(from)) { var condition = item.getNode("condition");
previous_condition = condition; if (skipping) {
continue; if (!item.equals(from)) {
} previous_condition = condition;
skipping = 0; continue;
} }
if (wait) { skipping = 0;
if (props.condition(previous_condition)) { }
reset_timeout(); if (wait) {
} else { if (props.condition(previous_condition)) {
if (timed_out()) { reset_timeout();
var title = checklist.getNode("title").getValue(); } else {
announce(title~": "~timeout_message.getValue()); if (timed_out()) {
} else { var title = checklist.getNode("title").getValue();
wait_for_completion(node: node, from: item); announce(title~": "~timeout_message.getValue());
} } else {
return; wait_for_completion(node: node, from: item);
} }
} return;
if (!props.condition(condition)) { }
foreach (var binding; item.getChildren("binding")) { }
active.setValue(1); if (!props.condition(condition)) {
props.runBinding(binding); foreach (var binding; item.getChildren("binding")) {
active.setValue(0); active.setValue(1);
} props.runBinding(binding);
} active.setValue(0);
previous_condition = condition; }
} }
previous_condition = condition;
}
}
} else {
foreach (var item; checklist.getChildren("item")) {
var condition = item.getNode("condition");
if (skipping) {
if (!item.equals(from)) {
previous_condition = condition;
continue;
}
skipping = 0;
}
if (wait) {
if (props.condition(previous_condition)) {
reset_timeout();
} else {
if (timed_out()) {
var title = checklist.getNode("title").getValue();
announce(title~": "~timeout_message.getValue());
} else {
wait_for_completion(node: node, from: item);
}
return;
}
}
if (!props.condition(condition)) {
foreach (var binding; item.getChildren("binding")) {
active.setValue(1);
props.runBinding(binding);
active.setValue(0);
}
}
previous_condition = condition;
}
}
} }
if (wait) { if (wait) {
announce(completed_message.getValue()); announce(completed_message.getValue());