-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransition.html
527 lines (431 loc) · 26.3 KB
/
transition.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
<!doctype html>
<html lang="en">
<head>
<title>Transition</title>
<meta charset="utf-8">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0">
<script src="jspsych-6.1.0/jspsych.js" ></script>
<script src="jspsych-6.1.0/plugins/jspsych-instructions.js"></script>
<script src="jspsych-6.1.0/plugins/jspsych-survey-text.js"></script>
<script src='./jspsych-6.1.0/plugins/jspsych-survey-html-form.js'></script>
<script src="jatos.js"></script>
<script src="./extra_functions/jspsych-instructions-timer.js"></script>
<script src='./extra_functions/helper_functions.js'></script>
<link rel="stylesheet" href="jspsych-6.1.0/css/jspsych.css" type="text/css"></link>
<link rel="stylesheet" href="./extra_files/congen.css" type="text/css"></link>
</head>
<body>
<script>
//start timeline
jatos.onLoad(function() {
// /////////////////////////////// HELPER FUNCTIONS ////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
const createPhaseDebriefer = function(iPhase,iConcept){
let phase_debriefer = {
type: 'survey-text',
questions: [
{prompt: 'How did you learn which ' + iConcept.concept_object + ' was hiding which toy? Did you have any strategy for memorizing?', rows: 3, columns: 100},
{prompt: 'Did you make any drawings or take any screenshots or pictures ' +
'to help remember which '+iConcept.concept_object+' was hiding which toy? <br>(you will not be penalised if you did, we just need to know so we can correctly analyze the data)', rows: 3, columns: 100},
],
button_label: 'Continue',
preamble: '<p style="font-size: 30px;"><b>Phase '+iPhase+' debriefing about the '+ iConcept.concept_object +'s with '+iConcept.dim1_name+' and '+iConcept.dim2_name +' :</b></p>',
data: {test_part: 'phase_' + iPhase + '_debriefer'},
};
return phase_debriefer
};
const createSpatialLayoutDebriefer = function(iPhase,iConcept){
let spatialLayoutImgEl = document.createElement('img')
spatialLayoutImgEl.src = './img/' + iConcept.concept_space + '/2d_space.png'
spatialLayoutImgEl.id = '2d_layout'
spatialLayoutImgEl.style.height = '300px'
spatialLayoutImgEl.style.width = '300px'
spatialLayoutImgEl.style.padding = '20px'
let spatial_questions = [
{prompt:
'During the experiment, did you ever visualize or imagine the '+ iConcept.concept_object + 's as organized in a 2-dimensional space, where each dimension specifies the '+
iConcept.dim1_name + ' and '+ iConcept.dim2_name + ' sizes? <br>In such a 2D space, toys can be thought of as "located" at the point of the bird that was hiding it.' +
'<br> If this question is unclear, please indicate below.',
rows: 3, columns: 100, placeholder: ''},
// {prompt:
// 'As you noticed, the '+ iConcept.concept_object + 's in phase 1 differed from each other by the size of their '+
// iConcept.dim1_name + ' and '+ iConcept.dim2_name + '. ' +
// 'Thus, each ' + iConcept.concept_object + ' can be represented as a point in a 2-dimensional space, ' +
// ' where each dimension specifies the size of '+ iConcept.dim1_name + ' and '+
// iConcept.dim2_name +
// '. <br><br>Thus, each toy that was hidden by some particular '+ iConcept.concept_object + ' has a "location" ' +
// ' in this 2-dimensional space.' +
// '<br><br>Did you realize or visualize such a 2-dimensional organization of the ' +
// iConcept.concept_object + 's and their toys?' +
// '<br> If you did realize this, did this help you in learning the '+
// iConcept.concept_object + '-toy associations?' +
// '<br> If this question is unclear, please indicate below.',
// rows: 3, columns: 100, placeholder: ''},
]
let spatial_preamble = '<p style="font-size: 30px;"><b>Phase '+ iPhase + ' debriefing about the '+ iConcept.concept_object + 's:</b></p>'
// A tag that will be added to the trial, will let us see in the results what this page was for
let tag = {test_part: 'phase_' + iPhase + '_spatial_layout'}
let spatialLayoutPage = createImageSurveyTrial(spatial_preamble,[spatialLayoutImgEl],spatial_questions,tag)
// Which imgs to preload?
imgs_to_preload.push(spatialLayoutImgEl.src)
return spatialLayoutPage
};
const createRealizeMappingDebriefer = function(){
let concept_1 = jatos.studySessionData.inputData.concepts.phase_1
let concept_2 = jatos.studySessionData.inputData.concepts.phase_2
// Which PA to use?
let targetPath_1 = jatos.studySessionData.inputData.basic_parameters.targetPathsUsed.phase_1[0]
let targetPath_2 = jatos.studySessionData.inputData.basic_parameters.targetPathsUsed.phase_2[0]
let targetName_1 = jatos.studySessionData.inputData.basic_parameters.targetNamesUsed.phase_1[0]
let idxOfTarget_1 = jatos.studySessionData.inputData.basic_parameters.targetPoints.phase_1[0]
let idxOfTarget_2 = jatos.studySessionData.inputData.basic_parameters.targetPoints.phase_2[0]
let pa_box_width, pa_box_height
pa_box_width = pa_box_height = jatos.studySessionData.inputData.basic_parameters.pa_box_width
let exemplar_1_width = jatos.studySessionData.inputData.concepts.phase_1.single_ex_img_width * (pa_box_width-90) / jatos.studySessionData.inputData.basic_parameters.sort_area_width * 1.6
let exemplar_2_width = jatos.studySessionData.inputData.concepts.phase_2.single_ex_img_width * (pa_box_width-90) / jatos.studySessionData.inputData.basic_parameters.sort_area_width * 1.6
// Wrapper flex element
let wrapperFlexEl = document.createElement('div')
wrapperFlexEl.style.display = 'flex'
wrapperFlexEl.style['justify-content'] = 'center'
wrapperFlexEl.style['align-items'] = 'center'
// Image showing an example PA from phase 1
let paEl_1 = document.createElement('div')
paEl_1.style.display = 'flex'
paEl_1.style['flex-direction'] = concept_1.debrief_flex_dir
paEl_1.style['justify-content'] = 'center'
paEl_1.style['align-items'] = 'center'
paEl_1.id = 'example_pa1'
paEl_1.style.border = '1px solid'
paEl_1.style.height = pa_box_height + 'px'
paEl_1.style.width = pa_box_width + 'px'
paEl_1.style['background-color'] = 'white'
paEl_1.style.margin = '20px'
// Image showing an example PA from phase 2
paEl_2 = paEl_1.cloneNode(true)
paEl_2.id = 'example_pa2'
paEl_2.style['flex-direction'] = concept_2.debrief_flex_dir
// Make the concept exemplar elements
let exemplarEl_1 = document.createElement('img')
exemplarEl_1.id = 'exemplarEl_1'
exemplarEl_1.src = './img/' + jatos.studySessionData.inputData.concepts.phase_1.concept_space + '/individual_imgs/stim_'+idxOfTarget_1+'.png'
exemplarEl_1.style.width = exemplar_1_width+'px'
exemplarEl_2 = exemplarEl_1.cloneNode(true)
exemplarEl_2.id = 'exemplarEl_2'
exemplarEl_2.src = './img/' + jatos.studySessionData.inputData.concepts.phase_2.concept_space + '/individual_imgs/stim_'+idxOfTarget_1+'.png'
exemplarEl_2.style.width = exemplar_2_width+'px'
// Make the toys
let toyElement_1 = document.createElement('img')
toyElement_1.id = 'toy_1'
toyElement_1.src = targetPath_1
toyElement_1.style.height = '50px'
toyElement_2 = toyElement_1.cloneNode(true)
toyElement_2.id = 'toy_2'
toyElement_2.src = targetPath_2
// Append all the elements to the flex box
paEl_1.appendChild(exemplarEl_1)
paEl_1.appendChild(toyElement_1)
paEl_2.appendChild(exemplarEl_2)
paEl_2.appendChild(toyElement_2)
wrapperFlexEl.appendChild(paEl_1)
wrapperFlexEl.appendChild(paEl_2)
let realize_mapping_questions = [
{prompt: 'During phase 2, did you realize that there is a relationship between the '+ concept_1.concept_object+'s ' +
'that hide the toys in phase 1 and '+ concept_2.concept_object+'s that hide toys in phase 2? <br> ' +
'For example, if a phase-1 '+ concept_1.concept_object+' with a certain '+ concept_1.dim1_name+':'+ concept_1.dim2_name+' ratio was hiding the '+targetName_1+' (as shown above), ' +
'the phase-2 '+ concept_1.concept_object+' that was hiding the '+targetName_1+' also had a similar ratio of '+ concept_2.dim1_name+':'+ concept_2.dim2_name+'.' +
' The same was true for the other toys.' +
'<br> If you did realize this, did this help you in performing during phase 2? If so, how did it help you? Please describe.', rows: 3, columns: 100, placeholder: ''},
]
let realize_mapping_preamble = '<p style="font-size: 30px;"><b>Phase 1 / Phase 2 debriefing:</b></p>'
// A tag that will be added to the trial, will let us see in the results what this page was for
let tag = {test_part: 'realize_mapping_page'}
let realize_mapping_page = createImageSurveyTrial(realize_mapping_preamble,[wrapperFlexEl],realize_mapping_questions,tag)
// Which images to preload? Add the exemplar and toy images
imgs_to_preload.push(exemplarEl_1.src, exemplarEl_2.src, toyElement_1.src, toyElement_2.src)
return realize_mapping_page
};
////////////////////////////////////////////////////////////////////////////////////////
// What phase is this?
let [curr_phase,phase_string,curr_session,curr_global_trial] = getPhaseAndSession()
let trial_dur_sec = jatos.studySessionData.timer_response_window / 1000
// Temp variables to hold the concept info, for convenience
let concept_1 = jatos.studySessionData.inputData.concepts.phase_1
let concept_2 = jatos.studySessionData.inputData.concepts.phase_2
// Create the score box
let score_box_element = createScoreBox()
score_box_element.style.margin = '0 auto'
let component_to_start
//make a timeline
var timeline = [];
// preload imgs in case defriefing page contains them. Start already with the target items
let imgs_to_preload = [...jatos.studySessionData.inputData.basic_parameters.targetPathsUsed[phase_string]];
// Generic message saying "sorry you failed QC". Will then be followed by appropriate debriefing pages, and data submission
var qc_failed_generic_page = {
type: 'instructions',
pages : [
'<div class="instruct">'+
'<p>Unfortunately, your performance did not pass our quality checks. </p> ' +
'<p>As we stated in the instructions, in such case we have to discontinue the study. </p>' +
'<p>You will be paid for completing the study up to this stage. </p> ' +
'<p>But first, please complete the debriefing survey by clicking the "Debrief" button.</p>' +
'<p>The last page contains information about the experiment, contact information of the researcher, and a button to redirect you to Prolific.</p>' +
'</div>'
],
show_clickable_nav: true,
button_label_next: '<span style="color: black"d;> <strong> Debrief </stong></span>',
allow_backward: false,
data: {test_part: 'qc_failed_generic_page'},
};
// In case they fail at the instructions or the practice trials
var qc_failed_instr_practice_page = {
type: 'instructions',
pages : [
'<div class="instruct">'+
'<p>Unfortunately, your performance did not pass our quality checks. </p> ' +
'<p>As we stated in the instructions, in such case we have to discontinue the study. </p>' +
'<p>You will be paid for completing the study up to this stage. </p> ' +
'<p>The next page contains contact information of the researcher, a button to redirect you to Prolific and ' +
'an explanation about the aims of this experiment. Note that the explanation might refer to parts of this experiment you did not get to.</p>' +
'</div>'
],
show_clickable_nav: true,
button_label_next: '<span style="color: black"d;> <strong> Continue </stong></span>',
allow_backward: false,
data: {test_part: 'qc_failed_instr_practice_page'},
};
// Generic message saying thank you for training please answer debrief
var training_finished_generic_page = {
type: 'instructions',
pages : [
'<div class="instruct">'+
'<p> Thank you very much! You have completed the training! </p> ' +
'<p> Below you can see your finishing scores for phase ' + curr_phase + ': </p>' +
score_box_element.outerHTML +
'<p> Please complete the debriefing survey by clicking the "Debrief" button.</p>' +
'<p>The last page contains information about the experiment, contact information of the researcher, and a button to redirect you to Prolific.</p>' +
'</div>'
],
show_clickable_nav: true,
button_label_next: '<span style="color: black"d;> <strong> Debrief </stong></span>',
allow_backward: false,
data: {test_part: 'training_finished_generic_page'},
};
// A page to explain the experiment at the very end, and redirect
let congruency_condition_name;
if (jatos.studySessionData.inputData.congruency){
congruency_condition_name = 'congruent'
} else {
congruency_condition_name = 'incongruent'
}
var debriefing_finished_generic_page = {
type: 'instructions',
pages: [
'<div class="instruct">'+
'<p> <strong> Click the "Finish Experiment" button at the bottom of this page, to submit your data and be redirected to Prolific! </strong></p> '+
'<p><br>Below, you can read what the experiment was about and find my contact information' +
' in case you have further questions. </p>' +
'<p><br>I am investigating human learning and memory; specifically how fast humans can learn new information and what influences that speed of learning.' +
'<p>Two versions of this experiment are released online: “congruent” and “incongruent” versions. </p>' +
'<p>You were in the "' + congruency_condition_name + '" condition.</p>' +
'<p>In the “congruent” condition, the phase 1 '+ concept_1.concept_object+' that was associated with a certain toy (for example the '+ jatos.studySessionData.inputData.basic_parameters.targetNamesUsed.phase_1[0] +') had a similar ratio of '+ concept_1.dim1_name+':'+ concept_1.dim2_name+' length as the ratio of '+ concept_2.dim1_name+':'+ concept_2.dim2_name+' length of the phase 2 '+ concept_2.concept_object+' that was associated with the same toy. In the “incongruent” condition, no such relationship between the ratio of '+ concept_1.dim1_name+':'+ concept_1.dim2_name+' and '+ concept_2.dim1_name+':'+ concept_2.dim2_name+' existed between the two phases. </p>' +
'<p>For the participants in the “congruent” condition, detecting a relationship between phase 1 and phase 2 should help complete phase 2 faster, compared to the participants in the “incongruent” condition. Such generalization of knowledge happens during “analogical thinking” and is known to be helpful in speeding up learning. For example, learning about the structure of an atom (heavy nucleus in the center orbited by lighter and smaller electrons) is much easier if one makes an analogy with the solar system (heavy sun in the center orbited by lighter and smaller planets). </p>' +
'<p> We are running multiple people in the “congruent” and “incongruent” conditions. We hope to show a difference between these two conditions, which would be evidence that the participants in the "congruent" condition engage in some form of analogical thinking. We then plan to explore various interventions that might facilitate or inhibit such analogical thinking. We hope that this paradigm can become a quick and systematic method to study generalization of information in humans, which will contribute to our understanding of how information and memories are organized in the human mind. </p>' +
'<p>We hope that understanding what factors improve generalization and analogical thinking will eventually lead to development of practical strategies and methods for improving these skills in everyday life, whether with students in classrooms or professionals in their careers. </p>' +
'<p>Thank you once again for completing the game and contributing to science!</p>' +
'<p>If you have any questions about the experiment, please do not hesitate to contact me at [email protected] </p>'+
'</div>'
],
show_clickable_nav: true,
button_label_next: '<span style="color: black"d;> <strong> Finish Experiment </stong></span>',
data: {test_part: 'debriefing_finished_generic_page'},
};
// Generic questions to ask regardless of where the ptp failed, or if the ptp succeeded
var general_questions_page = {
type: 'survey-text',
questions: [
{prompt: 'Were the game instructions clear? If not, please help us improve them.', rows: 3, columns: 100},
{prompt: 'Was the number of toys you had to "find" too high? Should we make it less or more?', rows: 3, columns: 100},
{prompt: 'Were '+ trial_dur_sec +' seconds enough on each trial to make your choice and learn from feedback?', rows: 3, columns: 100},
{prompt: 'Did you complete the experiment in fullscreen mode? (You will not be penalised if you did not. We just need to know).', rows: 3, columns: 100},
{prompt: 'Is there anything that would make the game easier or more fun?', rows: 3, columns: 100},
],
button_label: 'Continue',
preamble: '<p style="font-size: 30px;"><b>Please answer the following questions:</b></p>',
data: {test_part: 'general_questions_page'},
};
// Questions to ask for any specific phase
// Phase 1
var phase_1_questions_page = createPhaseDebriefer(1,jatos.studySessionData.inputData.concepts.phase_1)
// Phase 2
var phase_2_questions_page = createPhaseDebriefer(2,jatos.studySessionData.inputData.concepts.phase_2)
// Element asking about the spatial layout.
// Phase 1
var phase_1_spatial_page = createSpatialLayoutDebriefer(1,jatos.studySessionData.inputData.concepts.phase_1)
// Phase 2
var phase_2_spatial_page = createSpatialLayoutDebriefer(2,jatos.studySessionData.inputData.concepts.phase_2)
// Realize phase 3 was a repeat of 1? Relearn or remember?
var phase_3_was_1_page = {
type: 'survey-text',
questions: [
{prompt: 'For phase 3, did you realize that the same '+jatos.studySessionData.inputData.concepts.phase_3.concept_object+'s were hiding the same toys as in phase 1?', rows: 3, columns: 100},
{prompt: 'Did your phase 1 knowledge of which '+jatos.studySessionData.inputData.concepts.phase_1.concept_object+' was hiding which toy help you in phase 3? <br> Or did you re-learn the associations for phase 3 from scratch?', rows: 3, columns: 100},
],
button_label: 'Continue',
preamble: '<p style="font-size: 30px;"><b>Phase 3 and phase 1 relationship:</b></p>',
data: {test_part: 'phase_3_was_1_page'},
};
// Realize mapping?
var realize_mapping_page = createRealizeMappingDebriefer()
let short_break_conditional_statement;
// Depending on whether minimum number of sessions have been completed, give appropriate instructions:
if (curr_session < jatos.studySessionData.qc_criteria.min_training_sess){
short_break_page = [
'<p> Thank you so much for completing this session! <br> ' +
'We really appreciate you staying attentive and continuing to honestly perform the task. </p>' +
'<p> Below you can see your scores from the last session: </p>' +
score_box_element.outerHTML +
'<p>You must do at least 2 sessions for this phase of the game.</p>' +
'<p>After that, if you reach ' +
jatos.studySessionData.training_criterion + '% on each of these toys you will move to the next stage!</p>' +
'<p>You have '+(jatos.studySessionData.qc_criteria.max_training_sess - jatos.studySessionData.session_counter[phase_string]) + ' more sessions left to achieve those scores!</p>' +
'<p><br> Please take a ' + jatos.studySessionData.short_break_duration +
' second break and click the Next button or press the right-arrow button on the keyboard to start the next session. </p>'
]
} else {
short_break_page = [
'<p> Thank you so much for completing this session! <br> ' +
'We really appreciate you staying attentive and continuing to honestly perform the task. </p>' +
'<p> Below you can see your scores from the last session: </p>' +
score_box_element.outerHTML +
'<p> <br>Remember, you goal is to reach ' +
jatos.studySessionData.training_criterion + '% on each of these toys!</p>' +
'<p>You have '+(jatos.studySessionData.qc_criteria.max_training_sess - jatos.studySessionData.session_counter[phase_string]) + ' more sessions left to achieve those scores!</p>' +
'<p><br> Please take a ' + jatos.studySessionData.short_break_duration +
' second break and click the Next button or press the right-arrow button on the keyboard to start the next session. </p>'
]
}
// For short break
var short_break_page = {
type: 'instructions-timer',
pages: short_break_page,
show_clickable_nav: true,
button_label_next: "<span style='color: blue';> <strong> Next </stong></span>",
n_seconds: jatos.studySessionData.short_break_duration,
data: {test_part: 'short_break_page'},
};
// For long break
var long_break_page = {
type: 'instructions-timer',
pages: [
'<p> Congratulations! You have finished phase ' + curr_phase + ' of the game! </p>' +
'<p> Below you can see your finishing scores for phase ' + curr_phase + ': </p>' +
score_box_element.outerHTML +
'<p> Please take a ' + jatos.studySessionData.long_break_duration +
' second break, and then click the Next button to read instructions for phase ' +
(curr_phase+1) + '!</p>' +
'<p> Thank you very much for staying attentive! </p>'
],
show_clickable_nav: true,
button_label_next: "<span style='color: blue';> <strong> Next </stong></span>",
n_seconds: jatos.studySessionData.long_break_duration,
data: {test_part: 'long_break_page'},
};
let show_progress_bar = false
if (jatos.studySessionData.progress_state == 'starting'){
jatos.startComponentByPos(jatos.studySessionData.script_comp_pos.post_practice_instructions)
} else if (jatos.studySessionData.progress_state == 'advance_phase') {
timeline.push(long_break_page)
jatos.studySessionData.phase_counter ++
component_to_start = jatos.studySessionData.script_comp_pos.instructions
} else if (jatos.studySessionData.progress_state == 'advance_session'){
timeline.push(short_break_page)
jatos.studySessionData.session_counter[phase_string] ++
component_to_start = jatos.studySessionData.script_comp_pos.phase_pa
} else if (jatos.studySessionData.progress_state == 'qc_failed_instructions' ||
jatos.studySessionData.progress_state == 'qc_failed_practice'){
timeline.push(qc_failed_instr_practice_page)
timeline.push(debriefing_finished_generic_page)
component_to_start = jatos.studySessionData.script_comp_pos.data_submission
} else if (jatos.studySessionData.progress_state == 'qc_failed_phase_1'){
timeline.push(qc_failed_generic_page)
timeline.push(general_questions_page)
timeline.push(phase_1_questions_page)
timeline.push(phase_1_spatial_page)
timeline.push(debriefing_finished_generic_page)
component_to_start = jatos.studySessionData.script_comp_pos.data_submission
show_progress_bar = true
} else if (jatos.studySessionData.progress_state == 'qc_failed_phase_2'){
timeline.push(qc_failed_generic_page)
timeline.push(general_questions_page)
timeline.push(phase_1_questions_page)
timeline.push(phase_2_questions_page)
// Realize mapping?
if (jatos.studySessionData.inputData.congruency){
timeline.push(realize_mapping_page)
}
timeline.push(phase_1_spatial_page)
timeline.push(phase_2_spatial_page)
timeline.push(debriefing_finished_generic_page)
component_to_start = jatos.studySessionData.script_comp_pos.data_submission
show_progress_bar = true
} else if (jatos.studySessionData.progress_state == 'qc_failed_phase_3'){
timeline.push(qc_failed_generic_page)
timeline.push(general_questions_page)
timeline.push(phase_1_questions_page)
timeline.push(phase_2_questions_page)
// Realize mapping?
if (jatos.studySessionData.inputData.congruency){
timeline.push(realize_mapping_page)
}
timeline.push(phase_1_spatial_page)
timeline.push(phase_2_spatial_page)
timeline.push(phase_3_was_1_page)
timeline.push(debriefing_finished_generic_page)
component_to_start = jatos.studySessionData.script_comp_pos.data_submission
show_progress_bar = true
} else if (jatos.studySessionData.progress_state == 'finished_training'){
timeline.push(training_finished_generic_page)
timeline.push(general_questions_page)
timeline.push(phase_1_questions_page)
timeline.push(phase_2_questions_page)
// Realize mapping?
if (jatos.studySessionData.inputData.congruency){
timeline.push(realize_mapping_page)
}
timeline.push(phase_1_spatial_page)
timeline.push(phase_2_spatial_page)
if (jatos.studySessionData.max_phases > 2){
timeline.push(phase_3_was_1_page)
}
timeline.push(debriefing_finished_generic_page)
component_to_start = jatos.studySessionData.script_comp_pos.data_submission
show_progress_bar = true
} // checking progress state
if (!jatos.studySessionData.progress_state.includes('starting')){
jsPsych.init({
timeline: timeline,
show_progress_bar: show_progress_bar,
preload_images: imgs_to_preload,
on_finish: function() {
// If its a transition between sessions or phases, record in the transitions_results object
if (jatos.studySessionData.progress_state == 'advance_phase' ||
jatos.studySessionData.progress_state == 'advance_session'){
let idx = jatos.studySessionData.outputData[phase_string + '_transitions_results'].length
jatos.studySessionData.outputData[phase_string + '_transitions_results'][idx] = jsPsych.data.get().values();
// If its debrief, record in the debrief object
} else {
let idx = jatos.studySessionData.outputData[phase_string + '_debrief_results'].length
jatos.studySessionData.outputData[phase_string + '_debrief_results'][idx] = jsPsych.data.get().values();
}
jatos.submitResultData("[transition_start---" +
JSON.stringify(jatos.studySessionData) +
"---transition_end]", function(){
jatos.startComponentByPos(component_to_start);
});
}
});
}
});
</script>
</body>
</html>