Commit 74ff4c41 authored by TravisCarden's avatar TravisCarden

By TravisCarden: Only include items in saved progress that come from the checklist definition.

parent 229cff71
......@@ -5,9 +5,9 @@ Drupal.behaviors.checklistapiFieldsetSummaries = {
// Vertical tabs summaries.
$('#checklistapi-checklist-form .vertical-tabs-panes > fieldset', context).drupalSetSummary(function (context) {
var total = $(':checkbox', context).size(), args = {};
var total = $(':checkbox.checklistapi-item', context).size(), args = {};
if (total) {
args['@complete'] = $(':checkbox:checked', context).size();
args['@complete'] = $(':checkbox.checklistapi-item:checked', context).size();
args['@total'] = total;
args['@percent'] = Math.round(args['@complete'] / args['@total'] * 100);
return Drupal.t('@complete of @total (@percent%) complete', args);
......
......@@ -135,6 +135,7 @@ function checklistapi_checklist_form($form, &$form_state, $id) {
'#description' => filter_xss_admin($description),
'#default_value' => $default_value,
'#disabled' => !($user_has_edit_access = $checklist->userHasAccess('edit')),
'#attributes' => array('class' => array('checklistapi-item')),
);
}
}
......
......@@ -156,6 +156,12 @@ class ChecklistapiChecklist {
}
// Loop through items.
foreach ($group as $item_key => $item) {
$definition = checklistapi_get_checklist_info($this->id);
if (!in_array($item_key, array_keys($definition[$group_key]))) {
// This item wasn't in the checklist definition. Don't include it with
// saved progress.
continue;
}
$old_item = (!empty($this->savedProgress[$item_key])) ? $this->savedProgress[$item_key] : 0;
if ($item == 1) {
// Item is checked.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment