reset practice failure state on backward button - closes #2727

This commit is contained in:
Thibault Duplessis 2017-03-03 12:18:01 +01:00
parent d3d4f3f6d6
commit b61a774bf6

View file

@ -65,6 +65,7 @@ module.exports = function(root, studyData, data) {
};
var onFailure = function() {
root.vm.node.fail = true;
sound.failure();
};
@ -77,7 +78,11 @@ module.exports = function(root, studyData, data) {
return {
onReload: onLoad,
onJump: checkSuccess,
onJump: function() {
// reset failure state if no failed move found in mainline history
if (success() === false && !root.vm.nodeList.find(function(n) { return n.fail; })) success(null);
checkSuccess();
},
onCeval: checkSuccess,
data: data,
goal: goal,