Skip to content

Commit

Permalink
fix bug where the camera couldn't be set up on a frame immediately fo…
Browse files Browse the repository at this point in the history
…llowing a video-assent frame skipped due to child's age
  • Loading branch information
Kim Scott committed Mar 12, 2021
1 parent 5c3f358 commit 075e9fd
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions app/components/exp-lookit-video-assent/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,24 +425,7 @@ export default ExpFrameBaseComponent.extend(VideoRecord, ExpandAssets, {
},

didInsertElement() {
this._super(...arguments);
this.set('assentFormText', $('#consent-form-full-text').text());

var hasCompletedEachPageAudio = [];
for (let iPage = 0; iPage < this.get('pages_parsed').length; iPage++) {
hasCompletedEachPageAudio[iPage] = !this.get('pages_parsed')[iPage].audio; // count as completed if no audio
}
this.set('hasCompletedEachPageAudio', hasCompletedEachPageAudio);

var hasCompletedEachPageVideo = [];
for (let iPage = 0; iPage < this.get('pages_parsed').length; iPage++) {
hasCompletedEachPageVideo[iPage] = !this.get('pages_parsed')[iPage].video; // count as completed if no video
}
this.set('hasCompletedEachPageVideo', hasCompletedEachPageVideo);

this.set('pageIndex', -1);
this.send('nextVideo');

// Decide whether to skip based on age - do this BEFORE _super() to avoid setting up camera but immediately moving on
if (this.get('session').get('child') && this.get('session').get('child').get('birthday')) { // always show frame in preview mode
var dob = this.get('session').get('child').get('birthday');

Expand All @@ -464,9 +447,30 @@ export default ExpFrameBaseComponent.extend(VideoRecord, ExpandAssets, {
* @event skipAssentDueToParticipantAge
*/
this.send('setTimeEvent', 'skipAssentDueToParticipantAge');
this.set('doUseCamera', false);
this.send('next');
return;
}
}

this._super(...arguments);
this.set('assentFormText', $('#consent-form-full-text').text());

var hasCompletedEachPageAudio = [];
for (let iPage = 0; iPage < this.get('pages_parsed').length; iPage++) {
hasCompletedEachPageAudio[iPage] = !this.get('pages_parsed')[iPage].audio; // count as completed if no audio
}
this.set('hasCompletedEachPageAudio', hasCompletedEachPageAudio);

var hasCompletedEachPageVideo = [];
for (let iPage = 0; iPage < this.get('pages_parsed').length; iPage++) {
hasCompletedEachPageVideo[iPage] = !this.get('pages_parsed')[iPage].video; // count as completed if no video
}
this.set('hasCompletedEachPageVideo', hasCompletedEachPageVideo);

this.set('pageIndex', -1);
this.send('nextVideo');

}

});

0 comments on commit 075e9fd

Please sign in to comment.