Skip to content

Commit

Permalink
changed how the auto-answer feature is blocked in production versions…
Browse files Browse the repository at this point in the history
…, see #182
  • Loading branch information
jbphet committed Jul 13, 2018
1 parent df32e07 commit 9e61163
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
7 changes: 6 additions & 1 deletion js/common/ArithmeticQueryParameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ define( function( require ) {

var ArithmeticQueryParameters = QueryStringMachine.getAll( {

// Automatically answer most problems to enable faster testing of level completion.
// automatically answer most problems to enable faster testing of level completion
autoAnswer: { type: 'flag' }
} );

// prevent auto answer in versions that are intended for publication
if ( phet.chipper.isProduction && !phet.chipper.isDebugBuild ) {
ArithmeticQueryParameters.autoAnswer = false;
}

arithmetic.register( 'ArithmeticQueryParameters', ArithmeticQueryParameters );

return ArithmeticQueryParameters;
Expand Down
18 changes: 4 additions & 14 deletions js/common/model/ArithmeticModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ define( function( require ) {
this.activeLevelModel.gameTimer.start(); // may already be running, if so this is a no-op
this.refreshEmitter.emit();

// automatically answer most of the problems if enabled - this is for testing only
this.autoAnswerIfEnabled();
// automatically answer most of the problems if enabled - this is for testing
ArithmeticQueryParameters.autoAnswer && this.autoAnswer();
},

// @private
Expand All @@ -236,16 +236,6 @@ define( function( require ) {
} );
},

// @private, check if auto answer should be performed and, if so, do it
autoAnswerIfEnabled: function() {

// Automatically answer most of the problems if the autoAnswer query parameter was specified, but only if this is
// not a production release.
if ( ArithmeticQueryParameters.autoAnswer && window.phet.joist.sim.version.indexOf( '-' ) > 0 ) {
this.autoAnswer();
}
},

// @public - set the level to be played, initializing or restoring the level as appropriate
setLevel: function( level ) {
this.levelNumberProperty.set( level );
Expand All @@ -263,8 +253,8 @@ define( function( require ) {
else {
this.nextProblem();

// automatically answer most of the problems if enabled - this is for testing only
this.autoAnswerIfEnabled();
// automatically answer most of the problems if enabled - this is for testing
ArithmeticQueryParameters.autoAnswer && this.autoAnswer();
}
},

Expand Down

0 comments on commit 9e61163

Please sign in to comment.