Skip to content

Commit

Permalink
separate *requiring* a choice and *allowing* a choice on exp-lookit-i…
Browse files Browse the repository at this point in the history
…mages-audio frame
  • Loading branch information
Kim Scott committed Nov 13, 2020
1 parent 4443a92 commit 93b3df1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 7 additions & 1 deletion app/components/exp-lookit-images-audio/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ export default ExpFrameBaseComponent.extend(FullScreen, VideoRecord, ExpandAsset
minDurationAchieved: false,

choiceRequired: false,
choiceAllowed: false,
correctChoiceRequired: false,
correctImageSelected: false,
canMakeChoice: true,
Expand Down Expand Up @@ -654,6 +655,11 @@ export default ExpFrameBaseComponent.extend(FullScreen, VideoRecord, ExpandAsset
description: 'Whether this is a frame where the user needs to click to select one of the images before proceeding',
default: false
},
choiceAllowed: {
type: 'boolean',
description: 'Whether this is a frame where the user CAN select any of the images',
default: false
},
/**
* [Only used if `choiceRequired` is true] Whether the participant has to select
* one of the *correct* images before proceeding.
Expand Down Expand Up @@ -987,7 +993,7 @@ export default ExpFrameBaseComponent.extend(FullScreen, VideoRecord, ExpandAsset

clickImage(imageId, nonChoiceOption, correct, feedbackText) {
// If this is a choice frame and a valid choice and we're allowed to make a choice yet...
if (this.get('choiceRequired') && !nonChoiceOption && this.get('canMakeChoice') && !this.get('showingFeedbackDialog')) {
if ((this.get('choiceRequired') || this.get('choiceAllowed')) && !nonChoiceOption && this.get('canMakeChoice') && !this.get('showingFeedbackDialog')) {
this.set('finishedAllAudio', true); // Treat as if audio is finished in case making choice before audio finishes - otherwise we never satisfy that criterion
/**
* When one of the image options is clicked during a choice frame
Expand Down
9 changes: 6 additions & 3 deletions app/components/exp-lookit-images-audio/doc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,12 @@ pageColor [String | ``'white'``]
for acceptable syntax: can use color names ('blue', 'red', 'green', etc.), or
rgb hex values (e.g. '#800080' - include the '#')

choiceAllowed [Boolean | ``false``]
Whether the user may click on images to select them.

choiceRequired [Boolean | ``false``]
Whether this is a frame where the user needs to click to select one of the
images before proceeding.
Whether the user is able to select the images (overrides
choiceAllowed if choiceAllowed is false)

correctChoiceRequired [Boolean | ``false``]
[Only used if `choiceRequired` is true] Whether the participant has to select
Expand Down Expand Up @@ -872,4 +875,4 @@ and a "correct" response can be required to move on.
feedback as well as requiring a correct choice to move on.

5. If you were using a ``backgroundImage``, turn it into the first image in your image list, with
``"left": 0, "width": "100", "top": 0, "height": 100``.
``"left": 0, "width": "100", "top": 0, "height": 100``.

0 comments on commit 93b3df1

Please sign in to comment.