Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Set items to visited on "Complete page" (fix #89) #90

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions js/adapt-devtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import wait from 'core/js/wait';
import logging from 'core/js/logging';
import location from 'core/js/location';
import AdaptModel from 'core/js/models/adaptModel';
import ItemsComponentModel from 'core/js/models/itemsComponentModel';
import DevtoolsModel from './devtools-model';
import PassHalfFail from './pass-half-fail';
import ToggleBanking from './toggle-banking';
Expand Down Expand Up @@ -295,6 +296,10 @@ class DevtoolsView extends Backbone.View {
});
component.set('_attemptsLeft', Math.max(0, component.set('_attempts') - 1));
}
const isPresentationComponentWithItems = (!component.isTypeGroup('question') && component instanceof ItemsComponentModel);
if (isPresentationComponentWithItems) {
component.getChildren().forEach(child => child.set('_isVisited', true));
}
component.set('_isComplete', true);
component.set(currentModel.has('_isInteractionsComplete') ? '_isInteractionsComplete' : '_isInteractionComplete', true);
});
Expand Down
5 changes: 5 additions & 0 deletions js/toggle-completion.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Adapt from 'core/js/adapt';
import data from 'core/js/data';
import location from 'core/js/location';
import Utils from './utils';
import ItemsComponentModel from 'core/js/models/itemsComponentModel';

let mouseTarget = null;

Expand All @@ -24,6 +25,10 @@ function complete(element) {
const model = Utils.getModelForElement(element) || data.findById(location._currentId);
if (!model) return;
function doCompletion(component) {
const isPresentationComponentWithItems = (!component.isTypeGroup('question') && component instanceof ItemsComponentModel);
if (isPresentationComponentWithItems) {
component.getChildren().forEach(child => child.set('_isVisited', true));
}
component.set('_isComplete', true);
}
const descendantComponents = model.findDescendantModels('components');
Expand Down