Skip to content

Commit

Permalink
Merge pull request #357 from lookit/develop
Browse files Browse the repository at this point in the history
Fix survey-consent data availability; update Brazilian Portuguese translations; docs updates
  • Loading branch information
becky-gilbert authored Jan 29, 2024
2 parents edae6bf + 9a9ead1 commit ba09c18
Show file tree
Hide file tree
Showing 5 changed files with 289 additions and 359 deletions.
16 changes: 8 additions & 8 deletions app/components/exp-lookit-iframe/template.hbs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<iframe
height="{{ iframeHeight }}"
width="{{ iframeWidth }}"
src="{{ iframeSrc }}"
height={{ iframeHeight }}
width={{ iframeWidth }}
src={{ iframeSrc }}
sandbox="allow-scripts allow-same-origin"
referrerpolicy="no-referrer"
/>
{{#if optionalText }}<p>{{ optionalText }}</p>{{/if}}
{{#if optionalExternalLink }}
<p>
If you don't see anything in the space above, there might have been a problem loading this part of the study. Click
<a href="{{ iframeSrc }}" target="_blank" rel="noopener noreferrer">here</a>
to open this part of the study in a new tab. Make sure to keep this tab open so you can continue to the rest of the study.
</p>
<p>
If you don't see anything in the space above, there might have been a problem loading this part of the study. Click
<a href={{ iframeSrc }} target="_blank" rel="noopener noreferrer">here</a>
to open this part of the study in a new tab. Make sure to keep this tab open so you can continue to the rest of the study.
</p>
{{/if}}
<div class="row exp-controls">
<div class="col-md-12">
Expand Down
2 changes: 2 additions & 0 deletions app/components/exp-lookit-survey-consent/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export default ExpFrameBaseComponent.extend({
finish() {
let formValid = this.validate();
if (formValid) {
this.session.set('completedConsentFrame', true);
this.session.set('surveyConsent', true);
this.send('next');
} else {
$('div.exp-lookit-survey-form').scrollTop(0);
Expand Down
1 change: 1 addition & 0 deletions app/models/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default DS.Model.extend({
sequence: DS.attr({ defaultValue: () => [] }),
completed: DS.attr('boolean', {defaultValue: false}),
completedConsentFrame: DS.attr('boolean', {defaultValue: false}),
surveyConsent: DS.attr('boolean', {defaultValue: false}),
child: DS.belongsTo('child'),
study: DS.belongsTo('study'),
demographicSnapshot: DS.belongsTo('demographic'),
Expand Down
94 changes: 48 additions & 46 deletions app/utils/protocol-generator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ The ``child`` and the elements of the array ``pastSessions`` are Ember objects a

``pastSessions`` is an array of Ember objects representing past sessions for this child and this study, in reverse time order: pastSessions[0] is THIS session, pastSessions[1] the previous sessions, and so on. Each session has the following fields, corresponding to information available for download on Lookit, which can be accessed as ``pastSessions[i].get(<fieldName>)``:

(Note: ANY instance of a participant opening a study will be recorded as a session in ``pastSessions``, so make sure to use these fields to filter the sessions for what you're looking for, e.g. all sessions where consent has been completed, where the whole study has been completed, etc.)

* createdOn (Date)
* conditions
* expData
* sequence
* completed
* globalEventTimings
* completedConsentFrame (note - this list will include even "responses") where the user did not complete the consent form!
* completedConsentFrame
* demographicSnapshot
* isPreview

Expand Down Expand Up @@ -628,55 +630,55 @@ This example shows how to check the ``pastSessions`` for this study and child, t
function generateProtocol(child, pastSessions) {
let ineligible = false;
let ineligible = false;
// Check whether this child has done this study before AND finished it
try {
let completedSessions = pastSessions.some(function(session) {
return session.completed === true;
});
if (completedSessions) {
ineligible = true;
// Check whether this child has done this study before AND finished it
try {
let completedSessions = pastSessions.some(function(session) {
return session.completed === true;
});
if (completedSessions) {
ineligible = true;
}
} catch (error) {
// Wrap the above in a try block so that we can use a default protocol if there's an error
console.error(error);
}
} catch (error) {
// Wrap the above in a try block so that we can use a default protocol if there's an error
console.error(error);
}
// Set the default study protocol
let protocol = {
frames: {
"start-study": {
// Set the default study protocol
let protocol = {
frames: {
"start-study": {
"kind": "exp-lookit-text",
"blocks": [{
"title": "Welcome!",
"text": "This is the start of the study."
}]
},
// ... more frames
"exit-survey": {
"kind": "exp-lookit-exit-survey",
"debriefing": {
"title": "Thank you!",
"text": "You participated."
}
}
},
sequence: ["start-study", ... "exit-survey"]
};
// If the child is not eligible, add a frame to the start of the study warning parents about this
if (ineligible) {
protocol.frames["ineligible-warning"] = {
"showPreviousButton": false,
"kind": "exp-lookit-text",
"blocks": [{
"title": "Welcome!",
"text": "This is the start of the study."
"title": "It looks like you've completed this study already!",
"text": "We're only able to compensate you when your child is completing this study for the first time. You're welcome to continue doing the study, but we cannot provide compensation. If you think this is an error, please contact Becky Gilbert ([email protected])."
}]
},
// ... more frames
"exit-survey": {
"kind": "exp-lookit-exit-survey",
"debriefing": {
"title": "Thank you!",
"text": "You participated."
}
}
},
sequence: ["start-study", ... "exit-survey"]
};
// If the child is not eligible, add a frame to the start of the study warning parents about this
if (ineligible) {
protocol.frames["ineligible-warning"] = {
"showPreviousButton": false,
"kind": "exp-lookit-text",
"blocks": [{
"title": "It looks like you've completed this study already!",
"text": "We're only able to compensate you when your child is completing this study for the first time. You're welcome to continue doing the study, but we cannot provide compensation. If you think this is an error, please contact Becky Gilbert ([email protected])."
}]
};
protocol.sequence.unshift("ineligible-warning");
}
};
protocol.sequence.unshift("ineligible-warning");
}
return protocol;
}
return protocol;
}
Loading

0 comments on commit ba09c18

Please sign in to comment.