-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initial stab at combining ember-lookit-frameplayer and exp-addons int…
…o a single app that would be easier to install, maintain, and contribute to. so far able to participate in a study through a few frames, substantial bugs to work out.
- Loading branch information
Kim Scott
committed
Feb 20, 2019
1 parent
6d5d7a9
commit 090040c
Showing
306 changed files
with
68,237 additions
and
2,845 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ coverage | |
dist | ||
docs | ||
tmp | ||
tests/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
// See https://eslint.org/docs/user-guide/configuring#specifying-parser-options | ||
|
||
module.exports = { | ||
root: true, | ||
parserOptions: { | ||
ecmaVersion: 6, | ||
sourceType: 'module' | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
'impliedStrict': true | ||
} | ||
}, | ||
extends: 'eslint:recommended', | ||
env: { | ||
browser: true, | ||
es6: true | ||
'browser': true, | ||
'es6': true | ||
}, | ||
globals: { | ||
MathJax: true | ||
globals: { // true to allow overwriting | ||
'moment': false, | ||
'jsPDF': false | ||
}, | ||
rules: {} | ||
rules: { // 'warn', 'error', or 'off' | ||
'no-console': 'off' // allow console.log | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +0,0 @@ | ||
[submodule "lib"] | ||
path = lib | ||
url = https://github.com/lookit/exp-addons.git | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/bower_components | ||
/config/ember-try.js | ||
/dist | ||
/tests | ||
/tmp | ||
**/.gitkeep | ||
.bowerrc | ||
.editorconfig | ||
.ember-cli | ||
.gitignore | ||
.jshintrc | ||
.watchmanconfig | ||
.travis.yml | ||
bower.json | ||
ember-cli-build.js | ||
testem.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lts/boron |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* jshint node:true */ | ||
'use strict'; | ||
|
||
module.exports = { | ||
extends: 'recommended', | ||
rules: { | ||
'no-bare-strings': false, | ||
'block-indentation': 4 | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Ember from 'ember'; | ||
import layout from './template'; | ||
|
||
export default Ember.Component.extend({ | ||
layout | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{yield}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
import Ember from 'ember'; | ||
import layout from './template'; | ||
|
||
import {validator, buildValidations} from 'ember-cp-validations'; | ||
|
||
import moment from 'moment'; | ||
|
||
import ExpFrameBaseComponent from '../exp-frame-base/component'; | ||
import FullScreen from '../../mixins/full-screen'; | ||
|
||
/** | ||
* @module exp-player | ||
* @submodule frames | ||
*/ | ||
|
||
/** | ||
This is the exit survey used by "Your baby the physicist". Use the updated frame {{#crossLink "ExpLookitExitSurvey"}}{{/crossLink}} instead. | ||
@class ExpExitSurvey | ||
@extends ExpFrameBase | ||
@uses Validations | ||
@uses FullScreen | ||
*/ | ||
|
||
const Validations = buildValidations({ | ||
birthDate: validator('presence', { | ||
presence: true, | ||
message: 'This field is required' | ||
}), | ||
useOfMedia: validator('presence', { | ||
presence: true, | ||
message: 'This field is required', | ||
disabled(model) { | ||
return model.get('withdrawal'); | ||
} | ||
}), | ||
databraryShare: validator('presence', { | ||
presence: true, | ||
message: 'This field is required' | ||
}) | ||
}); | ||
|
||
export default ExpFrameBaseComponent.extend(Validations, FullScreen, { | ||
layout: layout, | ||
type: 'exp-exit-survey', | ||
fullScreenElementId: 'experiment-player', | ||
meta: { | ||
name: 'ExpExitSurvey', | ||
description: 'Exit survey for Lookit.', | ||
parameters: { | ||
type: 'object', | ||
properties: { | ||
} | ||
}, | ||
data: { | ||
type: 'object', | ||
properties: { | ||
birthDate: { | ||
type: 'string', | ||
default: null | ||
}, | ||
databraryShare: { | ||
type: 'string' | ||
}, | ||
useOfMedia: { | ||
type: 'string' | ||
}, | ||
withdrawal: { | ||
type: 'boolean', | ||
default: false | ||
}, | ||
feedback: { | ||
type: 'string', | ||
default: '' | ||
}, | ||
idealSessionsCompleted: { | ||
type: 'integer', | ||
default: 3 | ||
}, | ||
idealDaysSessionsCompleted: { | ||
type: 'integer', | ||
default: 14 | ||
} | ||
} | ||
} | ||
}, | ||
today: new Date(), | ||
section1: true, | ||
minVideosToCountSession: 6, | ||
showWithdrawalConfirmation: false, | ||
showValidation: false, | ||
actions: { | ||
advanceToProgressBar() { | ||
// Move from section 1 (survey) to section 2 (progress bar/ finish button) | ||
// Mark the session complete at this stage, as all data has been entered | ||
this.sendAction('sessionCompleted'); | ||
this._save() | ||
.then(()=> { | ||
this.set('section1', false); | ||
}) | ||
.catch(err => this.displayError(err)); | ||
}, | ||
continue() { | ||
// Check whether exit survey is valid, and if so, advance to next screen | ||
if (this.get('validations.isValid')) { | ||
if (this.get('withdrawal')) { | ||
this.set('showWithdrawalConfirmation', true); | ||
} else { | ||
this.send('advanceToProgressBar'); | ||
} | ||
} else { | ||
this.set('showValidation', true); | ||
} | ||
}, | ||
finish() { | ||
this.send('next'); | ||
} | ||
}, | ||
|
||
currentSessionStatus: Ember.computed('frameContext.pastSessions', function() { | ||
let nSessions = 0; | ||
const sessionDates = []; | ||
this.get('frameContext.pastSessions').forEach(session => { | ||
let nVideos = 0; | ||
Object.keys(session.get('expData')).forEach(frameKeyName => { | ||
if (frameKeyName.includes('pref-phys-videos')) { | ||
nVideos++; | ||
} | ||
}); | ||
// Count only sessions with at least minVideos pref-phys-videos frames | ||
if (nVideos >= this.get('minVideosToCountSession')) { | ||
nSessions++; | ||
sessionDates.pushObject(moment(session.get('createdOn'))); | ||
} | ||
}); | ||
return {'nSessions': nSessions, 'daysSessionsCompleted': moment.max(sessionDates).diff(moment.min(sessionDates), 'days') + 1 }; | ||
}), | ||
|
||
currentSessionsCompleted: Ember.computed('currentSessionStatus', function() { | ||
return this.get('currentSessionStatus.nSessions'); | ||
}), | ||
|
||
currentDaysSessionsCompleted: Ember.computed('currentSessionStatus', function() { | ||
return this.get('currentSessionStatus.daysSessionsCompleted'); | ||
}), | ||
|
||
progressValue: Ember.computed('currentSessionsCompleted', 'idealSessionsCompleted', function() { | ||
return Math.min(100, Math.ceil((this.get('currentSessionsCompleted') / this.get('idealSessionsCompleted')) * 100)); | ||
}), | ||
willRender() { | ||
this.send('exitFullscreen'); | ||
} | ||
}); |
Oops, something went wrong.