From 520edd7a719f4b2c4c71e894d5406cdbf7c480c7 Mon Sep 17 00:00:00 2001 From: jbphet Date: Wed, 4 Nov 2015 12:48:59 -0700 Subject: [PATCH] added code that allows autoAnswer to be used independently of assertions, but to still prevent it from appearing in a production release, see #111 --- js/common/model/ArithmeticModel.js | 3 ++- js/divide/model/DivideModel.js | 3 --- js/factor/model/FactorModel.js | 3 --- js/multiply/model/MultiplyModel.js | 3 --- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/js/common/model/ArithmeticModel.js b/js/common/model/ArithmeticModel.js index fd0cd220..0e0dfc79 100644 --- a/js/common/model/ArithmeticModel.js +++ b/js/common/model/ArithmeticModel.js @@ -241,7 +241,8 @@ define( function( require ) { this.initAnswerSheet( this.levelModels[ level ].tableSize ); this.nextProblem(); - if ( assert && window.phet.chipper.getQueryParameters().hasOwnProperty( 'autoAnswer' ) ) { + // enable auto answer if specified in the query params, but only if this is not a production release + if ( window.phet.joist.sim.version.indexOf( '-' ) > 0 && window.phet.chipper.getQueryParameter( 'autoAnswer' ) ) { this.autoAnswer(); } } diff --git a/js/divide/model/DivideModel.js b/js/divide/model/DivideModel.js index 0e12c197..9dcd98d7 100644 --- a/js/divide/model/DivideModel.js +++ b/js/divide/model/DivideModel.js @@ -75,9 +75,6 @@ define( function( require ) { * @protected */ autoAnswer: function() { - if ( !assert ) { - throw new Error( 'the autoAnswer function was called in a built version, this should never occur' ); - } var self = this; var numQuestions = this.answerSheet.length * this.answerSheet[ 0 ].length; var numQuestionsToAnswer = numQuestions - 1; diff --git a/js/factor/model/FactorModel.js b/js/factor/model/FactorModel.js index 4835c6bc..2b21ebd6 100644 --- a/js/factor/model/FactorModel.js +++ b/js/factor/model/FactorModel.js @@ -53,9 +53,6 @@ define( function( require ) { * @protected */ autoAnswer: function() { - if ( !assert ) { - throw new Error( 'the autoAnswer function was called in a built version, this should never occur' ); - } var self = this; var numQuestions = this.answerSheet.length * this.answerSheet[ 0 ].length; var numQuestionsToAnswer = numQuestions - 1; diff --git a/js/multiply/model/MultiplyModel.js b/js/multiply/model/MultiplyModel.js index 562f2d5c..eed1ad27 100644 --- a/js/multiply/model/MultiplyModel.js +++ b/js/multiply/model/MultiplyModel.js @@ -62,9 +62,6 @@ define( function( require ) { * @protected */ autoAnswer: function() { - if ( !assert ) { - throw new Error( 'the autoAnswer function was called in a built version, this should never occur' ); - } var self = this; var numQuestions = this.answerSheet.length * this.answerSheet[ 0 ].length; var numQuestionsToAnswer = numQuestions - 1;