diff --git a/js/common/EFACQueryParameters.js b/js/common/EFACQueryParameters.js index eed7d0ad..f58e94f2 100644 --- a/js/common/EFACQueryParameters.js +++ b/js/common/EFACQueryParameters.js @@ -72,8 +72,13 @@ define( require => { type: 'array', defaultValue: defaultElements, elementSchema: { type: 'string' }, - isValidValue: values => _.difference( values, defaultElements ).length === 0 && - values.length <= EFACConstants.MAX_NUMBER_OF_INTRO_ELEMENTS, + isValidValue: values => { + const beakers = _.filter( values, value => value === EFACConstants.WATER_KEY || value === EFACConstants.OLIVE_OIL_KEY ); + + return _.difference( values, defaultElements ).length === 0 && + values.length <= EFACConstants.MAX_NUMBER_OF_INTRO_ELEMENTS && + beakers.length <= EFACConstants.MAX_NUMBER_OF_INTRO_BEAKERS; + }, public: true } diff --git a/js/intro/EFACIntroScreen.js b/js/intro/EFACIntroScreen.js index 75f63c2d..76499c43 100644 --- a/js/intro/EFACIntroScreen.js +++ b/js/intro/EFACIntroScreen.js @@ -43,7 +43,7 @@ define( require => { }; const blocksToCreate = []; - let beakersToCreate = []; + const beakersToCreate = []; // map query parameter string to element type and split by blocks vs beakers EFACQueryParameters.elements.forEach( elementKey => { @@ -61,12 +61,6 @@ define( require => { } } ); - if( beakersToCreate.length > EFACConstants.MAX_NUMBER_OF_INTRO_BEAKERS ) { - assert && assert( false, `Only ${EFACConstants.MAX_NUMBER_OF_INTRO_BEAKERS} beakers may be added, but \ -${beakersToCreate.length} were provided: ${beakersToCreate}` ); - beakersToCreate = beakersToCreate.slice( 0, EFACConstants.MAX_NUMBER_OF_INTRO_BEAKERS ); - } - super( () => new EFACIntroModel( blocksToCreate,