diff --git a/app/Events/LeaderAnswered.php b/app/Events/LeaderAnswered.php index 0221bf9a..35962e1f 100644 --- a/app/Events/LeaderAnswered.php +++ b/app/Events/LeaderAnswered.php @@ -37,7 +37,7 @@ public function __construct(User $user) */ public function broadcastOn() { - return ['memory-channel']; + return ['task-channel']; } public function broadcastAs() diff --git a/app/Events/RoleChanged.php b/app/Events/RoleChanged.php new file mode 100644 index 00000000..347470f1 --- /dev/null +++ b/app/Events/RoleChanged.php @@ -0,0 +1,47 @@ +user = $user; + } + + /** + * Get the channels the event should broadcast on. + * + * @return Channel|array + */ + public function broadcastOn() + { + return ['task-channel']; + } + + public function broadcastAs() + { + return 'role-changed'; + } +} \ No newline at end of file diff --git a/app/GroupTask.php b/app/GroupTask.php index 70a69493..a1afb990 100644 --- a/app/GroupTask.php +++ b/app/GroupTask.php @@ -96,6 +96,7 @@ public static function initializeCombinedPilotTasks($group_id, $randomize) { $taskArray = '[ {"taskName":"Consent","taskParams":{"url_endpoint":"end-individual-task","hasIndividuals":"true","hasGroup":"false","subjectPool":"july_pilot"}}, {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"chat_notification"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"incognito"}}, {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"adblock"}}, {"taskName":"DeviceCheck","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"eligibility"}}, {"taskName":"Cryptography","taskParams":{"intro":"combined_pilot","hasIndividuals":"true","hasGroup":"false","mapping":"random","maxResponses":"10"}}, @@ -110,13 +111,61 @@ public static function initializeCombinedPilotTasks($group_id, $randomize) { return Self::initializeTasks($group_id, $taskArray, $randomize); } + #TASK LIST FOR PHASE 1+2 MEMORY PILOT + public static function initializeCombinedMemoryTasks($group_id, $randomize) { + $taskArray = '[ + {"taskName":"Consent","taskParams":{"url_endpoint":"end-individual-task","hasIndividuals":"true","hasGroup":"false","subjectPool":"memory_pilot"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"chat_notification"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"adblock"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"no_notes"}}, + {"taskName":"DeviceCheck","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"eligibility"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"intro"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"words_instructions"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"words_1"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"images_instructions"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"faces_1"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"story_instructions"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"story_1"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"results"}}, + {"taskName":"WaitingRoom","taskParams":{"hasIndividuals":"true","hasGroup":"false","task":"2"}} + ]'; + + + return Self::initializeTasks($group_id, $taskArray, $randomize); + } + + #TASK LIST FOR MEMORY WAITING ROOM SHORTCUT + public static function initializeMemoryWaitingRoomTasks($group_id, $randomize) { + $taskArray = '[ + {"taskName":"WaitingRoom","taskParams":{"hasIndividuals":"true","hasGroup":"false","task":"2"}} + ]'; + + + return Self::initializeTasks($group_id, $taskArray, $randomize); + } + #TASK LIST FOR PHASE 2 PILOT public static function initializePhaseTwoTasks($group_id, $randomize) { $taskArray = '[ + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"phase2_intro"}}, {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"chat_notification"}}, {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"adblock"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"incognito_p2"}}, {"taskName":"DeviceCheck","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"eligibility"}}, + {"taskName":"WaitingRoom","taskParams":{"hasIndividuals":"true","hasGroup":"false","task":"1"}} + ]'; + + return Self::initializeTasks($group_id, $taskArray, $randomize); + } + + #TASK LIST FOR PHASE 3 PILOT + public static function initializePhaseThreeTasks($group_id, $randomize) { + $taskArray = '[ {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"phase2_intro"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"chat_notification"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"adblock"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"incognito_p3"}}, + {"taskName":"DeviceCheck","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"eligibility"}}, {"taskName":"WaitingRoom","taskParams":{"hasIndividuals":"true","hasGroup":"false","task":"1"}} ]'; @@ -126,7 +175,7 @@ public static function initializePhaseTwoTasks($group_id, $randomize) { #FOR DEV PURPOSES public static function initializeTestTasks($group_id, $randomize) { $taskArray = '[ - {"taskName":"GroupSurvey","taskParams":{"hasIndividuals":"false","hasGroup":"true","type":"1","statementOrder":"ordered"}} + {"taskName":"DeviceCheck","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"eligibility"}} ]'; @@ -139,50 +188,138 @@ public static function initializeTestTasks($group_id, $randomize) { return Self::initializeTasks($group_id, $taskArray, $randomize); } - public static function initializeConclusionTasks($group_id, $randomize) { + public static function initializeCryptoConclusionTasks($group_id, $randomize,$qualtrics_type) { $taskArray = '[ - {"taskName":"Conclusion","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"mturk","hasCode":"false","displayScoreGroup":"false", "digitalReceipt":"false", "sonaId": "547", "payment": "30", "feedback":"true", "feedbackLinkType":"qualtrics"}} + {"taskName":"Cryptography","taskParams":{"intro":"phase-three-alt","hasIndividuals":"true","hasGroup":"false","mapping":"random","maxResponses":"10"}}, + {"taskName":"Conclusion","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"mturk","hasCode":"false","displayScoreGroup":"false", "digitalReceipt":"false", "sonaId": "547", "payment": "30", "feedback":"true", "feedbackLinkType":"'.$qualtrics_type.'"}} + ]'; + + return Self::initializeTasks($group_id, $taskArray, $randomize); + } + + public static function initializeConclusionTasks($group_id, $randomize,$qualtrics_type) { + $taskArray = '[ + {"taskName":"Conclusion","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"mturk","hasCode":"false","displayScoreGroup":"false", "digitalReceipt":"false", "sonaId": "547", "payment": "30", "feedback":"true", "feedbackLinkType":"'.$qualtrics_type.'"}} ]'; return Self::initializeTasks($group_id, $taskArray, $randomize); } //CALLED DURING THE ASSIGNGROUPS JOB TO CREATE SUBSESSION - public static function initializeCryptoTasks($group_id, $randomize,$final) { - if($final){ + public static function initializeCryptoTasks($group_id, $randomize,$final,$first) { + if($first && $final){ $taskArray = '[ {"taskName":"Cryptography","taskParams":{"hasIndividuals":"false","intro":"group_1","hasGroup":"true","mapping":"random","maxResponses":"10","type":"intro"}}, {"taskName":"Cryptography","taskParams":{"hasIndividuals":"false","intro":"group_1","hasGroup":"true","mapping":"random","maxResponses":"10","type":"task"}}, - {"taskName":"GroupSurvey","taskParams":{"hasIndividuals":"false","hasGroup":"true","type":"1","statementOrder":"ordered"}}, + {"taskName":"GroupSurvey","taskParams":{"hasIndividuals":"false","hasGroup":"true","type":"1","statementOrder":"ordered","task_name":"Cryptography"}}, + {"taskName":"Conclusion","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"mturk","hasCode":"false","displayScoreGroup":"false", "digitalReceipt":"false", "sonaId": "547", "payment": "30", "feedback":"true", "feedbackLinkType":"qualtrics"}} + ]'; + } + elseif($first){ + $taskArray = '[ + {"taskName":"Cryptography","taskParams":{"hasIndividuals":"false","intro":"group_1","hasGroup":"true","mapping":"random","maxResponses":"10","type":"intro"}}, + {"taskName":"Cryptography","taskParams":{"hasIndividuals":"false","intro":"group_1","hasGroup":"true","mapping":"random","maxResponses":"10","type":"task"}}, + {"taskName":"GroupSurvey","taskParams":{"hasIndividuals":"false","hasGroup":"true","type":"1","statementOrder":"ordered","task_name":"Cryptography"}}, + {"taskName":"WaitingRoom","taskParams":{"hasIndividuals":"false","hasGroup":"true","task":"1"}} + ]'; + } + elseif($final){ + $taskArray = '[ + {"taskName":"Cryptography","taskParams":{"hasIndividuals":"false","intro":"not_first","hasGroup":"true","mapping":"random","maxResponses":"10","type":"intro"}}, + {"taskName":"Cryptography","taskParams":{"hasIndividuals":"false","intro":"group_1","hasGroup":"true","mapping":"random","maxResponses":"10","type":"task"}}, + {"taskName":"GroupSurvey","taskParams":{"hasIndividuals":"false","hasGroup":"true","type":"1","statementOrder":"ordered","task_name":"Cryptography"}}, {"taskName":"Conclusion","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"mturk","hasCode":"false","displayScoreGroup":"false", "digitalReceipt":"false", "sonaId": "547", "payment": "30", "feedback":"true", "feedbackLinkType":"qualtrics"}} ]'; } else{ + $taskArray = '[ + {"taskName":"Cryptography","taskParams":{"hasIndividuals":"false","intro":"not_first","hasGroup":"true","mapping":"random","maxResponses":"10","type":"intro"}}, + {"taskName":"Cryptography","taskParams":{"hasIndividuals":"false","intro":"group_1","hasGroup":"true","mapping":"random","maxResponses":"10","type":"task"}}, + {"taskName":"GroupSurvey","taskParams":{"hasIndividuals":"false","hasGroup":"true","type":"1","statementOrder":"ordered","task_name":"Cryptography"}}, + {"taskName":"WaitingRoom","taskParams":{"hasIndividuals":"false","hasGroup":"true","task":"1"}} + ]'; + } + + return Self::initializeTasks($group_id, $taskArray, $randomize); + } + + //CALLED DURING THE ASSIGNGROUPS JOB TO CREATE SUBSESSION + public static function initializeCryptoWithIndividualTasks($group_id, $randomize,$final,$first) { + if($first && $final){ $taskArray = '[ {"taskName":"Cryptography","taskParams":{"hasIndividuals":"false","intro":"group_1","hasGroup":"true","mapping":"random","maxResponses":"10","type":"intro"}}, {"taskName":"Cryptography","taskParams":{"hasIndividuals":"false","intro":"group_1","hasGroup":"true","mapping":"random","maxResponses":"10","type":"task"}}, - {"taskName":"GroupSurvey","taskParams":{"hasIndividuals":"false","hasGroup":"true","type":"1","statementOrder":"ordered"}}, + {"taskName":"GroupSurvey","taskParams":{"hasIndividuals":"false","hasGroup":"true","type":"1","statementOrder":"ordered","task_name":"Cryptography","final":"true"}} + ]'; + } + elseif($first){ + $taskArray = '[ + {"taskName":"Cryptography","taskParams":{"hasIndividuals":"false","intro":"group_1","hasGroup":"true","mapping":"random","maxResponses":"10","type":"intro"}}, + {"taskName":"Cryptography","taskParams":{"hasIndividuals":"false","intro":"group_1","hasGroup":"true","mapping":"random","maxResponses":"10","type":"task"}}, + {"taskName":"GroupSurvey","taskParams":{"hasIndividuals":"false","hasGroup":"true","type":"1","statementOrder":"ordered","task_name":"Cryptography","final":"false"}}, + {"taskName":"WaitingRoom","taskParams":{"hasIndividuals":"false","hasGroup":"true","task":"1"}} + ]'; + } + elseif($final){ + $taskArray = '[ + {"taskName":"Cryptography","taskParams":{"hasIndividuals":"false","intro":"not_first","hasGroup":"true","mapping":"random","maxResponses":"10","type":"intro"}}, + {"taskName":"Cryptography","taskParams":{"hasIndividuals":"false","intro":"group_1","hasGroup":"true","mapping":"random","maxResponses":"10","type":"task"}}, + {"taskName":"GroupSurvey","taskParams":{"hasIndividuals":"false","hasGroup":"true","type":"1","statementOrder":"ordered","task_name":"Cryptography","final":"true"}} + ]'; + } + else{ + $taskArray = '[ + {"taskName":"Cryptography","taskParams":{"hasIndividuals":"false","intro":"not_first","hasGroup":"true","mapping":"random","maxResponses":"10","type":"intro"}}, + {"taskName":"Cryptography","taskParams":{"hasIndividuals":"false","intro":"group_1","hasGroup":"true","mapping":"random","maxResponses":"10","type":"task"}}, + {"taskName":"GroupSurvey","taskParams":{"hasIndividuals":"false","hasGroup":"true","type":"1","statementOrder":"ordered","task_name":"Cryptography","final":"false"}}, {"taskName":"WaitingRoom","taskParams":{"hasIndividuals":"false","hasGroup":"true","task":"1"}} ]'; } return Self::initializeTasks($group_id, $taskArray, $randomize); } + + public static function initializeMemoryTasks($group_id, $randomize,$final,$test) { + if($final){ + $taskArray = '[ + {"taskName":"Memory","taskParams":{"hasIndividuals":"false","hasGroup":"true","test":"group_'.$test.'_instructions","type":"intro"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"false","hasGroup":"true","test":"group_'.$test.'","type":"task"}}, + {"taskName":"GroupSurvey","taskParams":{"hasIndividuals":"false","hasGroup":"true","type":"1","statementOrder":"ordered","task_name":"Memory"}}, + {"taskName":"Conclusion","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"mturk","hasCode":"false","displayScoreGroup":"false", "digitalReceipt":"false", "sonaId": "547", "payment": "30", "feedback":"true", "feedbackLinkType":"memory"}} + ]'; + } + elseif($test == 1){ + $taskArray = '[ + {"taskName":"Memory","taskParams":{"hasIndividuals":"false","hasGroup":"true","test":"group_'.$test.'_instructions","type":"intro"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"false","hasGroup":"true","test":"group_'.$test.'","type":"task"}}, + {"taskName":"GroupSurvey","taskParams":{"hasIndividuals":"false","hasGroup":"true","type":"1","statementOrder":"ordered","task_name":"Memory"}}, + {"taskName":"WaitingRoom","taskParams":{"hasIndividuals":"false","hasGroup":"true","task":"2"}} + ]'; + } + else{ + $taskArray = '[ + {"taskName":"Memory","taskParams":{"hasIndividuals":"false","hasGroup":"true","test":"group_'.$test.'_instructions","type":"intro"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"false","hasGroup":"true","test":"group_'.$test.'","type":"task"}}, + {"taskName":"GroupSurvey","taskParams":{"hasIndividuals":"false","hasGroup":"true","type":"1","statementOrder":"ordered","task_name":"Memory"}}, + {"taskName":"WaitingRoom","taskParams":{"hasIndividuals":"false","hasGroup":"true","task":"2"}} + ]'; + } + + return Self::initializeTasks($group_id, $taskArray, $randomize); + } #TASK LIST FOR CRYPTO MTURK TEST - public static function initializeCryptoMturkTasks($group_id, $randomize) { + public static function initializeCryptoEndTasks($group_id, $randomize,$round) { $taskArray = '[ - {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"chat_notification"}}, - {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"adblock"}}, - {"taskName":"DeviceCheck","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"eligibility"}}, - {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"mturk_test"}}, - {"taskName":"WaitingRoom","taskParams":{"hasIndividuals":"false","hasGroup":"true","task":"1"}} + {"taskName":"Cryptography","taskParams":{"intro":"phase-three-alt","hasIndividuals":"true","hasGroup":"false","mapping":"random","maxResponses":"10"}}, + {"taskName":"Conclusion","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"mturk","hasCode":"false","displayScoreGroup":"false", "digitalReceipt":"false", "sonaId": "547", "payment": "30", "feedback":"true", "feedbackLinkType":"qualtrics'.$round.'"}} ]'; return Self::initializeTasks($group_id, $taskArray, $randomize); } + #TASK LIST FOR CRYPTO MTURK TEST public static function initializeEmptyTasks($group_id, $randomize,$final) { if($final){ @@ -223,8 +360,69 @@ public static function initializeCryptoPilotNoConsentTasks($group_id, $randomize #TASK LIST FOR INDIVIDUAL PILOT (INDIVIDUAL TASK LISTS ARE ALSO DEFINED HERE, NOT JUST GROUP) public static function initializeLabIndividualPilotTasks($group_id, $randomize) { - $taskArray = '[ - {"taskName":"Consent","taskParams":{"url_endpoint":"end-individual-task","hasIndividuals":"true","hasGroup":"false","subjectPool":"mturk"}}, + $coinflip = random_int(0,1); + if($coinflip == 1){ + $taskArray = '[ + {"taskName":"Consent","taskParams":{"url_endpoint":"end-individual-task","hasIndividuals":"true","hasGroup":"false","subjectPool":"individual_pilot"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"incognito"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"adblock"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"mturk"}}, + {"taskName":"Eyes","taskParams":{"hasIndividuals":"true","hasGroup":"false"}}, + {"taskName":"BigFive","taskParams":{"hasIndividuals":"true","hasGroup":"false","statementOrder":"random"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"intro"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"words_instructions"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"words_1"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"images_instructions"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"faces_1"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"story_instructions"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"story_1"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"results"}}, + {"taskName":"PsiIri","taskParams":{"hasIndividuals":"true","hasGroup":"false","statementOrder":"random"}}, + {"taskName":"Shapes","taskParams":{"hasIndividuals":"true","hasGroup":"false","subtest":"subtest5"}}, + {"taskName":"Leadership","taskParams":{"hasIndividuals":"true","hasGroup":"false","statementOrder":"random"}}, + {"taskName":"Cryptography","taskParams":{"intro":"intro","hasIndividuals":"true","hasGroup":"false","mapping":"random","maxResponses":"10"}}, + {"taskName":"Cryptography","taskParams":{"intro":"individual_alt","hasIndividuals":"true","hasGroup":"false","mapping":"random","maxResponses":"10"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"selection_page"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"selection_followup"}}, + {"taskName":"Conclusion","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"individual_pilot","hasCode":"false","displayScoreGroup":"false","digitalReceipt":"false","feedback":"true", "feedbackLinkType":"individual_pilot"}} + ]'; + } + else{ + $taskArray = '[ + {"taskName":"Consent","taskParams":{"url_endpoint":"end-individual-task","hasIndividuals":"true","hasGroup":"false","subjectPool":"individual_pilot"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"incognito"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"adblock"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"mturk"}}, + {"taskName":"Eyes","taskParams":{"hasIndividuals":"true","hasGroup":"false"}}, + {"taskName":"BigFive","taskParams":{"hasIndividuals":"true","hasGroup":"false","statementOrder":"random"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"intro"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"words_instructions"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"words_1"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"images_instructions"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"faces_1"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"story_instructions"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"story_1"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"results"}}, + {"taskName":"PsiIri","taskParams":{"hasIndividuals":"true","hasGroup":"false","statementOrder":"random"}}, + {"taskName":"Shapes","taskParams":{"hasIndividuals":"true","hasGroup":"false","subtest":"subtest5"}}, + {"taskName":"Leadership","taskParams":{"hasIndividuals":"true","hasGroup":"false","statementOrder":"random"}}, + {"taskName":"Cryptography","taskParams":{"intro":"intro","hasIndividuals":"true","hasGroup":"false","mapping":"random","maxResponses":"10"}}, + {"taskName":"Cryptography","taskParams":{"intro":"individual_alt","hasIndividuals":"true","hasGroup":"false","mapping":"random","maxResponses":"10"}}, + {"taskName":"Conclusion","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"individual_pilot","hasCode":"false","displayScoreGroup":"false","digitalReceipt":"false","feedback":"true", "feedbackLinkType":"individual_pilot"}} + ]'; + } + + return Self::initializeTasks($group_id, $taskArray, $randomize); + } + + #TASK LIST FOR INDIVIDUAL PILOT (INDIVIDUAL TASK LISTS ARE ALSO DEFINED HERE, NOT JUST GROUP) + public static function initializeLabIndividualOfficialTasks($group_id, $randomize) { + $coinflip = random_int(0,1); + if($coinflip == 1){ + $taskArray = '[ + {"taskName":"Consent","taskParams":{"url_endpoint":"end-individual-task","hasIndividuals":"true","hasGroup":"false","subjectPool":"individual_pilot"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"incognito"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"adblock"}}, {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"mturk"}}, {"taskName":"Eyes","taskParams":{"hasIndividuals":"true","hasGroup":"false"}}, {"taskName":"BigFive","taskParams":{"hasIndividuals":"true","hasGroup":"false","statementOrder":"random"}}, @@ -242,9 +440,34 @@ public static function initializeLabIndividualPilotTasks($group_id, $randomize) {"taskName":"Cryptography","taskParams":{"intro":"intro","hasIndividuals":"true","hasGroup":"false","mapping":"random","maxResponses":"10"}}, {"taskName":"Cryptography","taskParams":{"intro":"individual_alt","hasIndividuals":"true","hasGroup":"false","mapping":"random","maxResponses":"10"}}, {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"selection_page"}}, - {"taskName":"Feedback","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"mturk","hasCode":"true"}}, - {"taskName":"Conclusion","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"hdsl_individual","hasCode":"false","displayScoreGroup":"false","digitalReceipt":"false","feedback":"false", "feedbackLinkType":"pilot"}} + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"selection_followup"}}, + {"taskName":"Conclusion","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"mturk","hasCode":"false","displayScoreGroup":"false","digitalReceipt":"false","feedback":"true", "feedbackLinkType":"individual_pilot"}} + ]'; + } + else{ + $taskArray = '[ + {"taskName":"Consent","taskParams":{"url_endpoint":"end-individual-task","hasIndividuals":"true","hasGroup":"false","subjectPool":"individual_pilot"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"incognito"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"adblock"}}, + {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"mturk"}}, + {"taskName":"Eyes","taskParams":{"hasIndividuals":"true","hasGroup":"false"}}, + {"taskName":"BigFive","taskParams":{"hasIndividuals":"true","hasGroup":"false","statementOrder":"random"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"intro"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"words_instructions"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"words_1"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"images_instructions"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"faces_1"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"story_instructions"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"story_1"}}, + {"taskName":"Memory","taskParams":{"hasIndividuals":"true","hasGroup":"false","test":"results"}}, + {"taskName":"PsiIri","taskParams":{"hasIndividuals":"true","hasGroup":"false","statementOrder":"random"}}, + {"taskName":"Shapes","taskParams":{"hasIndividuals":"true","hasGroup":"false","subtest":"subtest5"}}, + {"taskName":"Leadership","taskParams":{"hasIndividuals":"true","hasGroup":"false","statementOrder":"random"}}, + {"taskName":"Cryptography","taskParams":{"intro":"intro","hasIndividuals":"true","hasGroup":"false","mapping":"random","maxResponses":"10"}}, + {"taskName":"Cryptography","taskParams":{"intro":"individual_alt","hasIndividuals":"true","hasGroup":"false","mapping":"random","maxResponses":"10"}}, + {"taskName":"Conclusion","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"mturk","hasCode":"false","displayScoreGroup":"false","digitalReceipt":"false","feedback":"true", "feedbackLinkType":"individual_pilot"}} ]'; + } return Self::initializeTasks($group_id, $taskArray, $randomize); } @@ -275,10 +498,9 @@ public static function initializeEQTasks($group_id, $randomize) { public static function initializeTestingTasks($group_id, $randomize) { $taskArray = '[ - {"taskName":"Consent","taskParams":{"hasIndividuals":"true","hasGroup":"false","subjectPool":"hdsl_individual"}}, - {"taskName":"Shapes","taskParams":{"hasIndividuals":"true","hasGroup":"false","subtest":"subtest5"}}, - {"taskName":"Survey","taskParams":{"hasIndividuals":"true","hasGroup":"false","survey":"hdsl"}}, - {"taskName":"Conclusion","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"hdsl_individual","hasCode":"false","displayScoreGroup":"false","digitalReceipt":"false","feedback":"false", "feedbackLinkType":"pilot"}} + {"taskName":"Cryptography","taskParams":{"intro":"intro","hasIndividuals":"true","hasGroup":"false","mapping":"random","maxResponses":"10"}}, + {"taskName":"Cryptography","taskParams":{"intro":"individual_alt","hasIndividuals":"true","hasGroup":"false","mapping":"random","maxResponses":"10"}}, + {"taskName":"Conclusion","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"mturk","hasCode":"false","displayScoreGroup":"false","digitalReceipt":"false","feedback":"true", "feedbackLinkType":"pilot"}} ]'; return Self::initializeTasks($group_id, $taskArray, $randomize); } @@ -286,12 +508,9 @@ public static function initializeTestingTasks($group_id, $randomize) { public static function initializeGroupTestTasks($group_id, $randomize) { $taskArray = '[ - {"taskName":"Intro","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"group_2"}}, - {"taskName":"ChooseReporter","taskParams":{"hasIndividuals":"true","hasGroup":"true"}}, - {"taskName":"Shapes","taskParams":{"hasIndividuals":"false","hasGroup":"true","subtest":"subtest5"}}, - {"taskName":"Optimization","taskParams":{"hasIndividuals":"true","hasGroup":"false","function":"1","intro":"individual","maxResponses":"10"}}, - {"taskName":"Cryptography","taskParams":{"hasIndividuals":"false","intro":"group_5","hasGroup":"true","mapping":"random","maxResponses":"10"}}, - {"taskName":"Conclusion","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"group_4","hasCode":"false","displayScoreGroup":"false", "digitalReceipt":"true", "sonaId": "547", "payment": "30", "feedback":"false", "feedbackLinkType":"group5Pilot"}} + {"taskName":"Cryptography","taskParams":{"intro":"intro","hasIndividuals":"true","hasGroup":"false","mapping":"random","maxResponses":"10"}}, + {"taskName":"Cryptography","taskParams":{"intro":"individual_alt","hasIndividuals":"true","hasGroup":"false","mapping":"random","maxResponses":"10"}}, + {"taskName":"Conclusion","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"mturk","hasCode":"false","displayScoreGroup":"false","digitalReceipt":"false","feedback":"true", "feedbackLinkType":"pilot"}} ]'; return Self::initializeTasks($group_id, $taskArray, $randomize); } @@ -306,25 +525,17 @@ public static function initializeWaitingRoomTasks($group_id, $randomize) { return Self::initializeTasks($group_id, $taskArray, $randomize); } - - - public static function initializeMemoryWaitingRoomTasks($group_id, $randomize) { - $taskArray = '[ - {"taskName":"WaitingRoom","taskParams":{"hasIndividuals":"false","hasGroup":"true","task":"2"}} - ]'; - return Self::initializeTasks($group_id, $taskArray, $randomize); - } - - - public static function initializeMemoryTasks($group_id, $randomize) { + public static function initializeDeviceCheckTasks($group_id, $randomize) { $taskArray = '[ - {"taskName":"Memory","taskParams":{"hasIndividuals":"false","hasGroup":"true","test":"group_1_instructions"}}, - {"taskName":"Memory","taskParams":{"hasIndividuals":"false","hasGroup":"true","test":"group_1"}}, - {"taskName":"Conclusion","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"group_1","hasCode":"false","displayScoreGroup":"false", "digitalReceipt":"false", "sonaId": "547", "payment": "30", "feedback":"false", "feedbackLinkType":"group1Pilot"}} + {"taskName":"DeviceCheck","taskParams":{"hasIndividuals":"false","hasGroup":"true","type":"eligibility"}}, + {"taskName":"Conclusion","taskParams":{"hasIndividuals":"true","hasGroup":"false","type":"mturk","hasCode":"false","displayScoreGroup":"false","digitalReceipt":"false","feedback":"true", "feedbackLinkType":"device"}} ]'; + + return Self::initializeTasks($group_id, $taskArray, $randomize); } + diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 8905026f..57268306 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -10,11 +10,9 @@ class AdminController extends Controller { public function getAdminHome() { - $sessionOneTimeslots = $this->getTimeslotData(547); - $sessionTwoTimeslots = $this->getTimeslotData(548); return view('layouts.admin.admin') - ->with('sessionOneSlots', $sessionOneTimeslots) - ->with('sessionTwoSlots', $sessionTwoTimeslots); + ->with('sessionOneSlots', []) + ->with('sessionTwoSlots', []); } public function getCSV() { @@ -104,7 +102,7 @@ private function getGroups() { public function getUsers() { - $users = \Teamwork\User::where('id', '>', 667) // When we went live with the lab version + $users = \Teamwork\User::where('id', '>', 1) // When we went live with the lab version ->with('group') ->get(); @@ -176,6 +174,24 @@ public function getIndividualCSV(Request $request) { } + //RULESETS + $rules = [ + 1=>[1,2], + 2=>[3,1,2], + 3=>[20,11,41,85,2,1], + 4=>[1,61,5,2,36,89], + 5=>[37,2,1,63,13,75], + 6=>[69,9,22,38,1,2], + 7=>[60,2,39,1,16,29], + 8=>[2,87,64,11,48,1], + 9=>[72,35,4,2,1,82], + 10=>[49,65,1,2,24,6], + 11=>[2,1,44,25,8,66], + 12=>[58,32,1,62,7,2], + 13=>[23,2,59,45,1,88], + 14=>[1,11,67,2,21,47] + ]; + $responseData = []; foreach($userData as $data) { foreach($data as $user) { @@ -195,6 +211,7 @@ public function getIndividualCSV(Request $request) { 'task' => $task['name'], 'introTime' => $task['introTime'], 'taskTime' => $task['taskTime'], + 'ruleset' => $task['ruleset'], 'prompt' => $response['prompt'], 'response' => $response['response'], 'correct' => $response['correct'], @@ -283,11 +300,35 @@ public function getGroupCSV(Request $request) { } + //RULESETS + $rules = [ + 1=>[1,2], + 2=>[3,1,2], + 3=>[20,11,41,85,2,1], + 4=>[1,61,5,2,36,89], + 5=>[37,2,1,63,13,75], + 6=>[69,9,22,38,1,2], + 7=>[60,2,39,1,16,29], + 8=>[2,87,64,11,48,1], + 9=>[72,35,4,2,1,82], + 10=>[49,65,1,2,24,6], + 11=>[2,1,44,25,8,66], + 12=>[58,32,1,62,7,2], + 13=>[23,2,59,45,1,88], + 14=>[1,11,67,2,21,47] + ]; + $responseData = []; foreach($userData as $data) { foreach($data as $user) { foreach($user['tasks'] as $task) { + if(array_key_exists($task['ruleset'],$rules)){ + $ruleset = implode(",",$rules[$task['ruleset']]); + } + else{ + $ruleset = ''; + } foreach($task['responses'] as $responses) { @@ -298,9 +339,11 @@ public function getGroupCSV(Request $request) { #Log::debug($user); $responseData[] = ['user' => $user['user'], 'group' => $user['group'], + 'role' => $response['role'], 'score' => $user['score'], 'task' => $task['name'], 'taskTime' => $task['taskTime'], + 'ruleset' => $ruleset, 'prompt' => $response['prompt'], 'response' => $response['response'], 'correct' => $response['correct'], @@ -329,7 +372,7 @@ public function getGroupCSV(Request $request) { $data = $responseData; $callback = function () use ($responseData) { $fileHandle = fopen('php://output', 'w'); - fputcsv($fileHandle,array('user', 'group', 'score', 'task', 'taskTime','prompt', 'response', 'correct', 'points', 'time'),"\t"); + fputcsv($fileHandle,array('user', 'group', 'role','score', 'task', 'taskTime','rules','prompt', 'response', 'correct', 'points', 'time'),"\t"); foreach ($responseData as $row) { fputcsv($fileHandle, $row, "\t"); } @@ -449,6 +492,7 @@ private function collectResponses($users, $groupId) { 'score' => $user->score, 'surveyCode' => $user->survey_code, 'group'=> $groupId, + 'role'=>$user->group_role, 'tasks' => []]; $groupTasks = \Teamwork\GroupTask::with('response') @@ -498,6 +542,7 @@ private function collectResponses($users, $groupId) { 'parameters' => $params, 'taskTime' => $taskTime, 'introTime' => $introTime, + 'ruleset' => $task->task_id, 'responses' => []]; $responses = []; diff --git a/app/Http/Controllers/AjaxController.php b/app/Http/Controllers/AjaxController.php index 2fb0620b..fcd47774 100644 --- a/app/Http/Controllers/AjaxController.php +++ b/app/Http/Controllers/AjaxController.php @@ -95,7 +95,7 @@ public function markIndividualReadyForGroup(Request $request) { $step = (int) $request->step; $teammates = \Teamwork\User::where('group_id', $request->group_id) ->get(); - foreach($teammates as $key => $teammate){ + /*foreach($teammates as $key => $teammate){ for($i = 1; $i < $step; $i++){ $has_turn_for_step = \DB::table('waiting') ->where('user_id', $teammate->id) @@ -112,7 +112,7 @@ public function markIndividualReadyForGroup(Request $request) { 'updated_at' => date("Y-m-d H:i:s")]); } } - } + }*/ if(!$exists){ \DB::table('waiting')->insert(['user_id' => $request->user_id, 'group_id' => $request->group_id, @@ -121,6 +121,7 @@ public function markIndividualReadyForGroup(Request $request) { 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")]); } + return '200'; } public function checkGroupReady(Request $request) { diff --git a/app/Http/Controllers/GroupTaskController.php b/app/Http/Controllers/GroupTaskController.php index 8178fe76..4bbfdd57 100644 --- a/app/Http/Controllers/GroupTaskController.php +++ b/app/Http/Controllers/GroupTaskController.php @@ -13,6 +13,7 @@ use Teamwork\Events\PlayerLeftWaitingRoom; use \Teamwork\Tasks as Task; use Teamwork\Events\ActionSubmitted; +use Teamwork\Events\RoleChanged; use Teamwork\Events\ClearStorage; use Teamwork\Events\RuleBroken; use Teamwork\Events\EndSubsession; @@ -60,6 +61,14 @@ public function getTask(Request $request) { $currentTask = $groupTasks->first(); $request->session()->put('currentGroupTask', $currentTask->id); + $parameters = unserialize($currentTask->parameters); + + if(($currentTask->name == 'Cryptography' || $currentTask->name == "Memory") ){ + if($parameters->hasGroup != 'true') + return redirect('/get-individual-task'); + } + + //send along to task router return $this->routeTask($currentTask); @@ -248,6 +257,9 @@ public function memoryGroupIntro(Request $request) { $user_id = \Auth::user()->id; $this_user = User::where('id',$user_id)->first(); + $this_user->status = 'Active'; + $this_user->save(); + event(new StatusChanged($this_user)); return view('layouts.participants.tasks.memory-group-intro') ->with('introType', $intro['test_name']) @@ -261,6 +273,7 @@ public function memory(Request $request) { $currentTask->started = 1; $currentTask->save(); + $parameters = unserialize($currentTask->parameters); $memory = new \Teamwork\Tasks\Memory; $test = $memory->getTest($parameters->test); @@ -282,7 +295,7 @@ public function memory(Request $request) { $group_users = \Teamwork\User::where('group_id',\Auth::user()->group_id)->get(); foreach($group_users as $key => $group_user){ $scores = $this->getIndividualMemoryTaskResults($group_user); - $group_users_array[$group_user->participant_id] = $scores; + $group_users_array[$group_user->group_role] = $scores; } // Determine is this user is the reporter for the group @@ -290,7 +303,10 @@ public function memory(Request $request) { $user_id = \Auth::user()->id; $this_user = User::where('id',$user_id)->first(); - + $this_user->status = 'Active'; + $this_user->in_room = 0; + $this_user->save(); + event(new StatusChanged($this_user)); // GABE: // Originally, there was an array of multiple tests. We've separated the // different memory tasks into individual tasks but to avoid rewriting a @@ -320,6 +336,7 @@ public function leaderAnswered(Request $request){ //RECORD MEMORY RESULTS public function saveMemory(Request $request) { + $this_user = User::where('id',\Auth::user()->id)->first(); $currentTask = \Teamwork\GroupTask::find($request->session()->get('currentGroupTask')); $parameters = unserialize($currentTask->parameters); $test = (new \Teamwork\Tasks\Memory)->getTest($parameters->test); @@ -331,6 +348,7 @@ public function saveMemory(Request $request) { // We'll record an empty response here so that participants will be // able to move on to the next task once they are done with the intro $r = new Response; + $r->role = $this_user->group_role; $r->group_tasks_id = $currentTask->id; $r->user_id = \Auth::user()->id; $r->prompt = 'Memory Intro'; @@ -405,6 +423,7 @@ public function saveMemory(Request $request) { $prompt = $tests[$indices[1]]['test_name'].' type: '.$tests[$indices[1]]['task_type'].' '.$tests[$indices[1]]['blocks'][$indices[2]]['type']; $r = new Response; + $r->role = $this_user->group_role; $r->user_id = \Auth::user()->id; $r->group_tasks_id = $currentTask->id; $r->individual_tasks_id = $request->session()->get('currentIndividualTask'); @@ -676,7 +695,8 @@ public function ruleBroken(Request $request) { $r->user_id = $user->id; $r->prompt = 'Rule Broken'; - $r->response = 'n/a'; + $r->response = $rule_broken; + $r->role = $user->group_role; $r->save(); return '200'; } @@ -687,6 +707,8 @@ public function cryptographyIntro(Request $request) { $user = User::find(\Auth::user()->id); $user->waiting = 0; $user->save(); + $follower1 = User::where('group_id',$user->group_id)->where('group_role','follower1')->first(); + $follower2 = User::where('group_id',$user->group_id)->where('group_role','follower2')->first(); $currentTask = GroupTask::find($request->session()->get('currentGroupTask')); //$currentTask = \Teamwork\GroupTask::where('group_id',$user->group_id)->where('name','Cryptography')->orderBy('created_at','DESC')->first(); $currentTask->started = 1; @@ -715,6 +737,33 @@ public function cryptographyIntro(Request $request) { $sorted = $mapping; sort($sorted); // Sort and re-index + $admin = User::find(1); + + if($admin->waiting != 2){ + $task_length = env("CRYPTO_TASK_LENGTH"); + if($admin->current_session == 1 and $admin->waiting < 4){ + $intro_length = env("CRYPTO_INTRO_LENGTH"); + } + else{ + $intro_length = env("CRYPTO_ALT_INTRO_LENGTH"); + } + $task_length -= $intro_length; + } + else{ + $task_length = env("MEMORY_TASK_LENGTH"); + if($admin->current_session == 1){ + $intro_length = env("MEMORY_INTRO_LENGTH"); + } + else{ + $intro_length = env("MEMORY_ALT_INTRO_LENGTH"); + } + $task_length -= $intro_length; + } + + $buffer_length = env("BUFFER_LENGTH"); + $survey_length = env("SURVEY_LENGTH"); + $total_length = $task_length + $intro_length + $buffer_length + $survey_length; + return view('layouts.participants.tasks.cryptography-group-intro') ->with('user', \Auth::user()) ->with('maxResponses', $maxResponses) @@ -724,11 +773,30 @@ public function cryptographyIntro(Request $request) { ->with('sorted', $aSorted) ->with('instructions',$currentTask->instructions) ->with('session_length',env('TASK_LENGTH',120)) - ->with('introType', 'group_1');//$introType); + ->with('task_length',$task_length) + ->with('buffer_length',$buffer_length) + ->with('survey_length',$survey_length) + ->with('total_length',$total_length) + ->with('follower1',$follower1) + ->with('follower2',$follower2) + ->with('intro_length',$intro_length) + ->with('introType', $parameters->intro);//$introType); + } + + public function assignRole(Request $request){ + $user = User::find($request->user); + $user->group_role = $request->role; + $user->save(); + event(new RoleChanged($user)); + + + return '200 OK'; } public function cryptography(Request $request) { $user = User::find(\Auth::user()->id); + $user->in_room = 0; + $user->save(); $isReporter = $this->isReporter(\Auth::user()->id, \Auth::user()->group_id); $currentTask = GroupTask::with('Response')->find($request->session()->get('currentGroupTask')); @@ -909,6 +977,7 @@ public function saveCryptographyResponse(Request $request) { } $r = new Response; + $r->role = $this_user->group_role; $r->group_tasks_id = $groupTaskId; $r->user_id = \Auth::user()->id; if($request->prompt == "Guess Full Mapping") { diff --git a/app/Http/Controllers/IndividualTaskController.php b/app/Http/Controllers/IndividualTaskController.php index 5a5dfb7e..d8e39fa1 100644 --- a/app/Http/Controllers/IndividualTaskController.php +++ b/app/Http/Controllers/IndividualTaskController.php @@ -187,6 +187,8 @@ public function groupSurvey(Request $request){ $admin = User::find(1); $currentTask = \Teamwork\GroupTask::find($request->session()->get('currentGroupTask')); + $currentTask->started = 1; + $currentTask->save(); $groupSurveyTask = \Teamwork\GroupTask::where('name','GroupSurvey') ->where('group_id',$this_user->group_id) @@ -196,6 +198,7 @@ public function groupSurvey(Request $request){ $parameters = unserialize($currentTask->parameters); + $task_name = $parameters->task_name; $this_progress = Progress::where('user_id',$this_user->id) ->where('group_id',$this_user->group_id) @@ -214,15 +217,36 @@ public function groupSurvey(Request $request){ $time_elapsed = $session_start->created_at->diffInSeconds(\Carbon\Carbon::now()); - $task_length = env('TASK_LENGTH',300); + if($admin->waiting != 2){ + $task_length = env('CRYPTO_TASK_LENGTH',300); + + $intro_length = env('CRYPTO_INTRO_LENGTH',300); + $alt_intro_length = env('CRYPTO_ALT_INTRO_LENGTH',30); + } + else{ + $task_length = env('MEMORY_TASK_LENGTH',300); + $intro_length = env('MEMORY_INTRO_LENGTH',300); + + $alt_intro_length = env('MEMORY_ALT_INTRO_LENGTH',30); + } $survey_length = env('SURVEY_LENGTH',120); $buffer_length = env('BUFFER_LENGTH',30); + $alt_task_length = $task_length - $intro_length + $alt_intro_length; + $session_length = $task_length + $survey_length + $buffer_length; - $time_remaining = $session_length * $admin->current_session - $time_elapsed - $buffer_length; + $alt_session_length = $alt_task_length + $survey_length + $buffer_length; + + if($admin->waiting < 4) + $time_remaining = $alt_session_length * ($admin->current_session - 1) + $session_length - $time_elapsed - $buffer_length; + else + $time_remaining = $alt_session_length * ($admin->current_session) - $time_elapsed - $buffer_length; + + + } else @@ -232,6 +256,8 @@ public function groupSurvey(Request $request){ ->with('surveyType',$parameters->type) ->with('time_remaining',$time_remaining) ->with('questions',$statements[$this_user->group_role == 'leader' ? 'leader' : 'member']) + ->with('task_name',$task_name) + ->with('admin',$admin) ->with('user',$this_user); } @@ -253,15 +279,36 @@ public function groupSurvey(Request $request){ $time_elapsed = $session_start->created_at->diffInSeconds(\Carbon\Carbon::now()); - $task_length = env('TASK_LENGTH',300); + if($admin->waiting != 2){ + $task_length = env('CRYPTO_TASK_LENGTH',300); + + $intro_length = env('CRYPTO_INTRO_LENGTH',300); + + $alt_intro_length = env('CRYPTO_ALT_INTRO_LENGTH',30); + } + else{ + $task_length = env('MEMORY_TASK_LENGTH',300); + + $intro_length = env('MEMORY_INTRO_LENGTH',300); + + $alt_intro_length = env('MEMORY_ALT_INTRO_LENGTH',30); + } $survey_length = env('SURVEY_LENGTH',120); $buffer_length = env('BUFFER_LENGTH',30); + + $alt_task_length = $task_length - $intro_length + $alt_intro_length; + $session_length = $task_length + $survey_length + $buffer_length; - $time_remaining = $session_length * $admin->current_session - $time_elapsed - $buffer_length; + $alt_session_length = $alt_task_length + $survey_length + $buffer_length; + + if($admin->waiting <4) + $time_remaining = $alt_session_length * ($admin->current_session - 1) + $session_length - $time_elapsed - $buffer_length; + else + $time_remaining = $alt_session_length * ($admin->current_session) - $time_elapsed - $buffer_length; } else @@ -271,6 +318,8 @@ public function groupSurvey(Request $request){ ->with('surveyType',$parameters->type) ->with('time_remaining',$time_remaining) ->with('questions',$statements[$this_user->group_role == 'leader' ? 'leader' : 'member']) + ->with('task_name',$task_name) + ->with('admin',$admin) ->with('user',$this_user); } @@ -289,6 +338,9 @@ public function saveGroupSurvey(Request $request) { // Record the end time for this task $this->recordEndTime($request, 'task'); + Log::debug($request); + Log::debug($request['tech_issues']); + foreach ($statements[$user->group_role == 'leader' ? 'leader' : 'member'] as $count => $statements_page) { foreach($statements_page as $key => $statement){ @@ -302,6 +354,44 @@ public function saveGroupSurvey(Request $request) { } } + if($request['tech_issues'] == "yes"){ + $r = new Response; + $r->group_tasks_id = $currentTask->id; + $r->individual_tasks_id = $individualTaskId; + $r->user_id = \Auth::user()->id; + $r->prompt = "tech_issues"; + $r->response = "yes"; + $r->save(); + } + else{ + $r = new Response; + $r->group_tasks_id = $currentTask->id; + $r->individual_tasks_id = $individualTaskId; + $r->user_id = \Auth::user()->id; + $r->prompt = "tech_issues"; + $r->response = "no"; + $r->save(); + } + + $admin = User::find(1); + if($admin->waiting > 2 and $parameters->final == "true"){ + $g = new \Teamwork\Group; + $g->save(); + $user->group_id = $g->id; + $user->save(); + try{ + \DB::table('group_user') + ->insert(['user_id' => $user->id, + 'group_id' => $g->id, + 'created_at' => date("Y-m-d H:i:s"), + 'updated_at' => date("Y-m-d H:i:s")]); + } + catch(\Exception $e){ + // Will throw an exception if the group ID and user ID are duplicates. Just ignore + } + + \Teamwork\GroupTask::initializeCryptoEndTasks($g->id,$randomize=false,$admin->waiting - 2); + } //$currentTask->completed = 1; //$currentTask->save(); @@ -523,9 +613,30 @@ public function studyIntro(Request $request) { $introContent = (new \Teamwork\Tasks\Intro)->getIntro($parameters->type); + $admin = User::find(1); + + if($admin->waiting != 2){ + $task_length = env("CRYPTO_TASK_LENGTH"); + $min_task_length = $task_length - env("CRYPTO_INTRO_LENGTH") + env("CRYPTO_ALT_INTRO_LENGTH"); + } + else{ + $task_length = env("MEMORY_TASK_LENGTH"); + $min_task_length = $task_length - env("MEMORY_INTRO_LENGTH") + env("MEMORY_ALT_INTRO_LENGTH"); + } + + $buffer_length = env("BUFFER_LENGTH"); + $survey_length = env("SURVEY_LENGTH"); + $max_total_length = $task_length + $buffer_length + $survey_length; + $min_total_length = $min_task_length + $buffer_length +$survey_length; + return view('layouts.participants.participant-study-intro') ->with('introContent', $introContent) ->with('user',$this_user) + ->with('task_length',$task_length) + ->with('buffer_length',$buffer_length) + ->with('survey_length',$survey_length) + ->with('max_total_length',$max_total_length) + ->with('min_total_length',$min_total_length) ->with('type',$parameters->type); } @@ -824,16 +935,12 @@ public function studyConclusion(Request $request) { $code = $conclusion->getConfirmationCode(\Auth::user()->id)->code; else $code = null; - if(\Auth::user()->survey_code){ - $url = 'https://harvarddecisionlab.sona-systems.com/services/SonaAPI.svc/WebstudyCredit?experiment_id=549&credit_token=0d9329ec68f446afa677b3dff496e3db&survey_code='.\Auth::user()->survey_code; - file_get_contents($url); - } - return view('layouts.participants.participant-study-conclusion') ->with('conclusionContent', $conclusionContent) ->with('code', $user->survey_code) ->with('score', false) + ->with('type',$parameters->type) ->with('checkEligibility', $parameters->displayScoreGroup == 'true') ->with('eligible', $eligibility) ->with('feedbackLink', $feedbackLink) @@ -1217,26 +1324,32 @@ public function cryptographyIntro(Request $request) { - + $parameters = unserialize($currentTask->parameters); $time = Time::where('user_id',\Auth::user()->id) ->where('group_tasks_id',$currentTask->id) ->where('type','intro') ->first(); + if($parameters->intro == 'individual_alt') + $duration = 60; + elseif($parameters->intro == 'phase-three-alt') + $duration = 60; + else + $duration = 60; if($time){ - $time_remaining = 300 - \Carbon\Carbon::parse($time->start_time)->diffInSeconds(\Carbon\Carbon::now()); + $time_remaining = $duration - \Carbon\Carbon::parse($time->start_time)->diffInSeconds(\Carbon\Carbon::now()); Log::debug($time); Log::debug('pls'); }else{ Log::debug('no'); $this->recordStartTime($request, 'intro'); - $time_remaining = 300; + $time_remaining = $duration; } //$time = Time::where('user_id',$this_user->id)->where('group_tasks_id',$currentTask->id)->where('type','intro')->first(); //$currentTask = \Teamwork\GroupTask::find($request->session()->get('currentGroupTask')); - $parameters = unserialize($currentTask->parameters); + if($currentTask->name != 'Cryptography'){ if($parameters->hasGroup == 'true'){ @@ -1262,6 +1375,14 @@ public function cryptographyIntro(Request $request) { ->with('sorted', $aSorted) ->with('time_remaining',$time_remaining); } + elseif($parameters->intro == 'phase-three-alt'){ + return view('layouts.participants.tasks.cryptography-individual-phasethree-intro') + ->with('maxResponses', $maxResponses) + ->with('mapping', json_encode($mapping)) + ->with('aSorted', $aSorted) + ->with('sorted', $aSorted) + ->with('time_remaining',$time_remaining); + } return view('layouts.participants.tasks.cryptography-individual-intro') ->with('maxResponses', $maxResponses) @@ -1293,6 +1414,7 @@ public function deviceCheck(Request $request){ public function cryptography(Request $request) { $user = User::find(\Auth::user()->id); + $admin = User::find(1); //$isReporter = $this->isReporter(\Auth::user()->id, \Auth::user()->group_id); $this->recordEndTime($request, 'intro'); $currentTask = \Teamwork\GroupTask::with('response')->find($request->session()->get('currentGroupTask')); @@ -1323,17 +1445,148 @@ public function cryptography(Request $request) { ->where('type','task') ->first(); if ($time){ - $time_remaining = 600 - \Carbon\Carbon::parse($time->start_time)->diffInSeconds(\Carbon\Carbon::now()); + $time_remaining = 540 - \Carbon\Carbon::parse($time->start_time)->diffInSeconds(\Carbon\Carbon::now()); } else{ $this->recordStartTime($request, 'task'); - $time_remaining = 600; - } + $time_remaining = 540; + } + + if($parameters->intro == "intro") + $task_id = 1; + elseif($parameters->intro == 'individual_alt') + $task_id = 2; + elseif($admin->waiting == 3){ + $task_id = 3 + $admin->current_session; + } + elseif($admin->waiting == 4){ + $task_id = 7 + $admin->current_session; + } + elseif($admin->waiting == 5){ + $task_id = 11 + $admin->current_session; + } + + $currentTask->task_id = $task_id; + $currentTask->save(); + + + $rules = [ + 1=>[1,2], + 2=>[3,1,2], + 3=>[20,11,41,85,2,1], + 4=>[1,61,5,2,36,89], + 5=>[37,2,1,63,13,75], + 6=>[69,9,22,38,1,2], + 7=>[60,2,39,1,16,29], + 8=>[2,87,64,11,48,1], + 9=>[72,35,4,2,1,82], + 10=>[49,65,1,2,24,6], + 11=>[2,1,44,25,8,66], + 12=>[58,32,1,62,7,2], + 13=>[23,2,59,45,1,88], + 14=>[1,11,67,2,21,47] + ]; + + $rule_desc = [ + 'An equation cannot use all 10 letters', + 'Equations must use at least 2 different letters', + 'The 2nd and 5th equations must contain a minus sign', + 'The 3rd and 4th equations must contain a minus sign', + 'The 4th and 7th equations must contain a minus sign', + 'The 3rd and 7th equations must contain a minus sign', + 'The 2nd and 8th equations must contain a minus sigh', + 'The 3rd and 9th equations must contain a minus sign', + 'The 4th and 5th equations must NOT contain a minus sign', + 'The 3rd and 5th equations must NOT contain a minus sign', + 'The 3rd, 5th, and 7th equations must contain an odd number of letters', + 'The 3rd and 6th equations must contain 3 letters', + 'The 2nd and 4th equations must contain 3 letters', + 'The 2nd and 6th equations must contain 3 letters', + 'The 5th and 7th equations must contain 3 letters', + 'The 4th and 8th equations must contain 3 letters', + 'The 1st equation must contain a minus sign', + 'The 2nd equation must contain a minus sign', + '', + '', + 'The 2nd equation must NOT contain a minus sign', + 'The 2nd equation must contain the letter F', + 'The 2nd equation must contain the letter G', + 'The 2nd equation must contain the letter H', + 'The 2nd equation must contain the letter I', + 'The 2nd equation must NOT contain the letter A', + 'The 2nd equation must NOT contain the letter J', + 'The 2nd equation must NOT contain the letter E', + 'The 2nd equation must NOT contain the letter B', + 'The 3rd equation must contain a minus sign', + 'The 3rd equation must NOT contain the letter F', + 'The 3rd equation must NOT contain the letter G', + 'The 3rd equation must NOT contain the letter H', + 'The 3rd equation must NOT contain the letter I', + 'The 3rd equation must contain the letter C', + 'The 3rd equation must contain the letter J', + 'The 3rd equation must contain the letter E', + 'The 3rd equation must contain the letter B', + 'The 3rd equation must contain the letter A', + 'The 4th equation must contain a minus sign', + 'The 4th equation must NOT contain the letter F', + 'The 4th equation must NOT contain the letter G', + 'The 4th equation must NOT contain the letter H', + 'The 4th equation must NOT contain the letter I', + 'The 4th equation must contain the letter C', + 'The 4th equation must contain the letter J', + 'The 4th equation must contain the letter E', + 'The 4th equation must contain the letter B', + 'The 4th equation must contain the letter A', + 'The 5th equation must contain a minus sign', + 'The 5th equation must NOT contain the letter A', + 'The 5th equation must NOT contain the letter J', + 'The 5th equation must NOT contain the letter E', + 'The 5th equation must NOT contain the letter I', + 'The 5th equation must contain the letter C', + 'The 5th equation must contain the letter H', + 'The 5th equation must contain the letter F', + 'The 5th equation must contain the letter D', + 'The 5th equation must contain the letter B', + 'The 6th equation must contain a minus sign', + 'The 6th equation must NOT contain the letter F', + 'The 6th equation must NOT contain the letter G', + 'The 6th equation must NOT contain the letter H', + 'The 6th equation must NOT contain the letter I', + 'The 6th equation must contain the letter C', + 'The 6th equation must contain the letter J', + 'The 6th equation must contain the letter E', + 'The 6th equation must contain the letter B', + 'The 6th equation must contain the letter A', + 'The 7th equation must contain a minus sign', + 'The 7th equation must NOT contain the letter A', + 'The 7th equation must NOT contain the letter J', + 'The 7th equation must NOT contain the letter E', + 'The 7th equation must NOT contain the letter I', + 'The 7th equation must contain the letter C', + 'The 7th equation must contain the letter H', + 'The 7th equation must contain the letter F', + 'The 7th equation must contain the letter D', + 'The 7th equation must contain the letter B', + 'The 8th equation must contain a minus sign', + 'The 8th equation must NOT contain the letter B', + 'The 8th equation must NOT contain the letter D', + 'The 8th equation must NOT contain the letter F', + 'The 8th equation must NOT contain the letter I', + 'The 8th equation must contain the letter C', + 'The 8th equation must contain the letter H', + 'The 8th equation must contain the letter A', + 'The 8th equation must contain the letter E', + 'The 8th equation must contain the letter G' + + ]; + return view('layouts.participants.tasks.cryptography-individual') ->with('user',$user) + ->with('rules',$rules[$currentTask->task_id]) + ->with('rule_desc',$rule_desc) ->with('task_id',$currentTask->task_id) ->with('mapping',json_encode($mapping)) ->with('sorted', $sorted) diff --git a/app/Http/Controllers/LoginController.php b/app/Http/Controllers/LoginController.php index f678a0e1..11272125 100644 --- a/app/Http/Controllers/LoginController.php +++ b/app/Http/Controllers/LoginController.php @@ -9,6 +9,7 @@ use Illuminate\Http\Request; use Teamwork\User; use Teamwork\Group; +use Teamwork\GroupTask; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Auth; @@ -46,11 +47,11 @@ public function participantPackageWaveLogin($package,$wave) { $date = User::where('id',1)->first()->signature; - if(\Auth::check()){ + if(\Auth::check() && User::find(\Auth::user()->id)->updated_at >= \Carbon\Carbon::now()->startOfDay()){ return view('layouts.participants.participant-login') ->with('in_session',$in_session) ->with('package', $package) - ->with('wave',5) + ->with('wave',8) ->with('participant_id',User::find(\Auth::user()->id)->participant_id) ->with('date',$date); } @@ -58,7 +59,7 @@ public function participantPackageWaveLogin($package,$wave) { return view('layouts.participants.participant-login') ->with('in_session',$in_session) ->with('package', $package) - ->with('wave',5) + ->with('wave',8) ->with('participant_id',NULL) ->with('date',$date); } @@ -72,18 +73,27 @@ public function participantPackageLogin($package) { $wave = 1; if(\Auth::check() && User::find(\Auth::user()->id)->updated_at >= \Carbon\Carbon::now()->startOfDay()){ - return view('layouts.participants.participant-login') - ->with('in_session',$in_session) - ->with('package', $package) - ->with('wave',5) - ->with('participant_id',User::find(\Auth::user()->id)->participant_id) - ->with('date',$date); + $user = User::find(\Auth::user()->id); + $currentTask = GroupTask::where('group_id',$user->group_id) + ->where('completed',0) + ->orderBy('order','ASC') + ->first(); + if(is_null($currentTask)){ + return view('layouts.participants.participant-login') + ->with('in_session',$in_session) + ->with('package', $package) + ->with('wave',8) + ->with('participant_id',$user->participant_id) + ->with('date',$date); + } + else + return redirect('/task-room'); } return view('layouts.participants.participant-login') ->with('in_session',$in_session) ->with('package', $package) - ->with('wave',5) + ->with('wave',8) ->with('participant_id',NULL) ->with('date',$date); } @@ -118,13 +128,14 @@ public function postParticipantLogin(Request $request) { $group->save(); $user->group_id = $group->id; + $user->current_session = 0; $user->save(); } //ELSE FIND IT else $group = Group::find($user->group_id); - + $user->current_session = 0; $user->save(); \Auth::login($user); @@ -139,10 +150,10 @@ public function postParticipantLogin(Request $request) { //MARK IT IN THE SESSION AS THE CURRENT TASK $request->session()->put('currentGroupTask', $currentTask->id); //SEND THEM TO IT - if($currentTask->name == 'Cryptography' or $currentTask->Name == "Memory" or $currentTask->name == "EmptyTask" ) + if(($currentTask->name == 'Cryptography' or $currentTask->Name == "Memory" or $currentTask->name == "EmptyTask") && $currentTask->hasGroup) return redirect('/task-room'); else - return redirect('get-group-task'); + return redirect('get-individual-task'); } @@ -172,7 +183,7 @@ public function postParticipantLogin(Request $request) { return redirect('/task-room'); } elseif($request->task_package == 'test'){ - \Teamwork\GroupTask::initializeTestTasks(\Auth::user()->group_id, $randomize = false); + \Teamwork\GroupTask::initializeCryptoEndTasks(\Auth::user()->group_id, $randomize = false); } elseif($request->task_package == 'group-1'){ \Teamwork\GroupTask::initializeGroupOneTasks(\Auth::user()->group_id, $randomize = false); @@ -201,6 +212,16 @@ public function postParticipantLogin(Request $request) { \Teamwork\GroupTask::initializeCombinedPilotTasks(\Auth::user()->group_id, $randomize = false); return redirect('/get-individual-task'); } + //ASSIGN COMBINED MEMORY PILOT TASKS + elseif($request->task_package == 'combined-memory-pilot'){ + \Teamwork\GroupTask::initializeCombinedMemoryTasks(\Auth::user()->group_id, $randomize = false); + return redirect('/get-individual-task'); + } + //ASSIGN MEMORY WAITING ROOM TASKS + elseif($request->task_package == 'memory-waiting-room'){ + \Teamwork\GroupTask::initializeMemoryWaitingRoomTasks(\Auth::user()->group_id, $randomize = false); + return redirect('/get-individual-task'); + } //ASSIGN MTURK TEST TASKS elseif($request->task_package == 'mturk-test'){ \Teamwork\GroupTask::initializeCryptoMturkTasks(\Auth::user()->group_id, $randomize = false); @@ -211,6 +232,31 @@ public function postParticipantLogin(Request $request) { \Teamwork\GroupTask::initializeLabIndividualPilotTasks(\Auth::user()->group_id, $randomize = false); return redirect('/get-individual-task'); } + //ASSIGNS PHASE 1 PILOT TASKS + elseif($request->task_package == 'phase-one'){ + \Teamwork\GroupTask::initializeLabIndividualOfficialTasks(\Auth::user()->group_id, $randomize = false); + return redirect('/get-individual-task'); + } + elseif($request->task_package == 'device-check'){ + \Teamwork\GroupTask::initializeDeviceCheckTasks(\Auth::user()->group_id, $randomize = false); + return redirect('/get-individual-task'); + } + elseif($request->task_package == 'phase-two'){ + \Teamwork\GroupTask::initializePhaseTwoTasks(\Auth::user()->group_id, $randomize = false); + return redirect('/get-individual-task'); + } + elseif($request->task_package == 'phase-two-alt'){ + \Teamwork\GroupTask::initializeCryptoWithIndividualTasks(\Auth::user()->group_id, $randomize = false); + return redirect('/get-individual-task'); + } + elseif($request->task_package == 'phase-three'){ + \Teamwork\GroupTask::initializePhaseThreeTasks(\Auth::user()->group_id, $randomize = false); + return redirect('/get-individual-task'); + } + elseif($request->task_package == 'crypto-conclusion'){ + \Teamwork\GroupTask::initializeCryptoConclusionTasks(\Auth::user()->group_id, $randomize = false); + return redirect('/get-individual-task'); + } //ASSIGN PHASE 2 PILOT TASKS elseif($request->task_package == 'group-pilot'){ \Teamwork\GroupTask::initializePhaseTwoTasks(\Auth::user()->group_id, $randomize = false); diff --git a/app/Http/Controllers/TaskRoomController.php b/app/Http/Controllers/TaskRoomController.php index 218c794f..fbf63a97 100644 --- a/app/Http/Controllers/TaskRoomController.php +++ b/app/Http/Controllers/TaskRoomController.php @@ -17,6 +17,7 @@ class TaskRoomController extends Controller public function taskRoom(Request $request){ $admin = User::where('id',1)->first(); + $task = $admin->waiting; $time_remaining = null; @@ -27,15 +28,44 @@ public function taskRoom(Request $request){ $time_elapsed = $session_start->created_at->diffInSeconds(\Carbon\Carbon::now()); - $task_length = env('TASK_LENGTH',300); + - $survey_length = env('SURVEY_LENGTH',120); + if($task != 2){ + $task_length = env('CRYPTO_TASK_LENGTH',300); - $buffer_length = env('BUFFER_LENGTH',30); - - $session_length = $task_length + $survey_length + $buffer_length; + $survey_length = env('SURVEY_LENGTH',120); + + $buffer_length = env('BUFFER_LENGTH',30); + + $intro_length = env('CRYPTO_INTRO_LENGTH',180); + + $alt_intro_length = env('CRYPTO_ALT_INTRO_LENGTH',180); + } + else{ + $task_length = env('MEMORY_TASK_LENGTH',300); + + $survey_length = env('SURVEY_LENGTH',120); + + $buffer_length = env('BUFFER_LENGTH',30); + + $intro_length = env('MEMORY_INTRO_LENGTH',180); + + $alt_intro_length = env('MEMORY_ALT_INTRO_LENGTH',180); + + + } + + $alt_task_length = $task_length - $intro_length + $alt_intro_length; - $time_remaining = ($session_length * $admin->current_session) - $time_elapsed - ($survey_length + $buffer_length); + $session_length = $task_length + $survey_length + $buffer_length; + + $alt_session_length = $alt_task_length + $survey_length + $buffer_length; + if($admin->waiting < 4) + $time_remaining = $alt_session_length * ($admin->current_session - 1) + $session_length - $time_elapsed - ($survey_length + $buffer_length); + else + $time_remaining = $alt_session_length * ($admin->current_session) - $time_elapsed - ($survey_length + $buffer_length); + + } else @@ -56,14 +86,46 @@ public function taskRoom(Request $request){ ->where('completed',0) ->orderBy('order','ASC') ->first(); + $request->session()->put('currentGroupTask',$currentTask->id); $parameters = unserialize($currentTask->parameters); - if($currentTask->name == "Cryptography" && $parameters->type == "intro"){ - $time_remaining -= (env('TASK_LENGTH',600) - env('INTRO_LENGTH',180)); - $time_label = "Time Until Task Begins"; + //IF THE TASK ISN'T CRYPTO OR MEMORY, DON'T USE TASK-ROOM + if($currentTask->name != "Cryptography" && $currentTask->name != "Memory" && $currentTask->name != "EmptyTask"){ + if($parameters->hasGroup == "true") + return redirect('/get-group-task'); + else + return redirect('/get-individual-task'); + } + + else{ + if(($currentTask->name == "Cryptography" || $currentTask->name == "Memory") && $parameters->hasGroup != 'true') + return redirect('/get-individual-task'); + } + + if(($currentTask->name == "Cryptography" || $currentTask->name == "Memory") && $parameters->type == "intro"){ + if($currentTask->name == "Cryptography"){ + if($admin->current_session == 1 and $admin->waiting < 4){ + $time_remaining -= $task_length - $intro_length; + } + else{ + $time_remaining -= $alt_task_length - $alt_intro_length; + } + + $time_label = "Time Until Task Begins"; + } + else{ + if($admin->current_session == 1){ + $time_remaining -= $task_length - $intro_length; + $time_label = "Time remaining for Instructions and Practice Exercise"; + } + else{ + $time_remaining -= $alt_task_length - $alt_intro_length; + $time_label = "Time until Main Task begins"; + } + } $time_color = "red"; } else{ @@ -71,9 +133,7 @@ public function taskRoom(Request $request){ $time_color = "black"; } - //IF THE TASK ISN'T CRYPTO OR MEMORY, DON'T USE TASK-ROOM - if($currentTask->name != "Cryptography" && $currentTask->name != "Memory" && $currentTask->name != "EmptyTask") - return redirect('get-group-task'); + return view('layouts.participants.task-room') ->with('user', $user) diff --git a/app/Http/Controllers/WaitingRoomController.php b/app/Http/Controllers/WaitingRoomController.php index f53f8e03..39edbd35 100644 --- a/app/Http/Controllers/WaitingRoomController.php +++ b/app/Http/Controllers/WaitingRoomController.php @@ -76,16 +76,16 @@ public function getWaitingRoom(Request $request){ //GET ENTRY FOR THIS USER $user_id = \Auth::user()->id; $this_user = User::where('id',$user_id)->first(); + $this_user->touch(); - if($this_user->group_role == ''){ + //if($this_user->group_role == ''){ - return view('layouts.participants.no-role-assigned'); - } + //} //WE USE SIGNATURE_DATE AS A WAY OF INDICATING WHO ENTERED THE WAITING ROOM AT ALL, FOR CREDIT GRANTING PURPOSES IN THE PILOT STAGE $this_user->signature_date = \Carbon\Carbon::now(); //EITHER 0 FOR NOT-IN-WAITING-ROOM, 1 FOR CRYPTO, OR 2 FOR MEMORY - $this_user->in_room = $task; + $this_user->in_room = 1; //STATUS IS USED FOR DISPLAYING SESSION DATA ON ADMIN-PAGE $this_user->status = 'Active'; @@ -93,27 +93,63 @@ public function getWaitingRoom(Request $request){ //SEND EVENT TO LET ADMIN PAGE KNOW THAT USER IS ACTIVE AND IN WAITING ROOM event(new StatusChanged($this_user)); + $admin = User::find(1); - //ADMIN USER CONTAINS INFO ABOUT CURRENT SESSION - $admin = User::where('id',1)->first(); //IF SESSION IS ACTIVE, DISPLAY TIMER INDICATING COUNTDOWN TO NEXT SUBSESSION + if($task == 2){ + $task_length = env('MEMORY_TASK_LENGTH',300); + + $intro_length = env('MEMORY_INTRO_LENGTH',300); + + $alt_intro_length = env('MEMORY_ALT_INTRO_LENGTH',30); + + } + else{ + $task_length = env('CRYPTO_TASK_LENGTH',300); + + $intro_length = env('CRYPTO_INTRO_LENGTH',300); + + $alt_intro_length = env('CRYPTO_ALT_INTRO_LENGTH',30); + } + + $survey_length = env('SURVEY_LENGTH',120); + + $buffer_length = env('BUFFER_LENGTH',30); + if($admin->current_session){ - $session_start = \Teamwork\Time::where('type','session')->orderBy('created_at','desc')->first(); + if($admin->current_session != 1 or $admin->waiting >= 4){ + $session_start = \Teamwork\Time::where('type','session')->orderBy('created_at','desc')->first(); - $time_elapsed = $session_start->created_at->diffInSeconds(\Carbon\Carbon::now()); - - $task_length = env('TASK_LENGTH',300); + $time_elapsed = $session_start->created_at->diffInSeconds(\Carbon\Carbon::now()); - $survey_length = env('SURVEY_LENGTH',120); + $alt_task_length = $task_length - $intro_length + $alt_intro_length; - $buffer_length = env('BUFFER_LENGTH',30); + $session_length = $alt_task_length + $survey_length + $buffer_length; + + $first_session_length = $task_length + $survey_length + $buffer_length; + + $time_remaining = $first_session_length + ($session_length * ($admin->current_session-1)) - $time_elapsed; + } + else{ + $session_start = \Teamwork\Time::where('type','session')->orderBy('created_at','desc')->first(); - $session_length = $task_length + $survey_length + $buffer_length; + $time_elapsed = $session_start->created_at->diffInSeconds(\Carbon\Carbon::now()); - $time_remaining = ($session_length * $admin->current_session) - $time_elapsed; + $session_length = $task_length + $survey_length + $buffer_length; + + $time_remaining = ($session_length * $admin->current_session) - $time_elapsed; + } + } - else + else{ $time_remaining = NULL; + } + + if(is_null($admin->current_session)){ + $this_user->current_session = 0; + $this_user->save(); + } + $room_users = User::where('in_room',$task)->where('id','!=',1)->orderBy('updated_at','ASC')->get(); @@ -126,6 +162,7 @@ public function getWaitingRoom(Request $request){ return view('layouts.participants.waiting-room') ->with('users',$room_users) + ->with('user',$this_user) ->with('task',$task) ->with('PUSHER_APP_KEY',config('app.PUSHER_APP_KEY')) ->with('time_remaining',$time_remaining); @@ -150,10 +187,11 @@ public function stillHere(Request $request){ } $room_users = User::where('in_room',1)->where('status','Active')->where('id','!=',1)->get(); + $now = \Carbon\Carbon::now(); foreach($room_users as $key => $room_user) { - $diff = $room_user->updated_at->diffInSeconds(\Carbon\Carbon::now()); + $diff = $room_user->updated_at->diffInSeconds($now); if($diff > 5){ @@ -183,39 +221,75 @@ public function adminPage(Request $request){ $waitingRoomMembers = User::where('in_room',1)->where('id','!=',1)->get(); - $activeGroupTasks = GroupTask::where('started',1)->where('name',"Cryptography")->where('order',1)->where('created_at','>',\Carbon\Carbon::now()->startOfDay())->get(); + $activeGroupTasks = GroupTask::where('started',1)->whereNotIn('name',array('WaitingRoom','Conclusion'))->where('completed',0)->where('created_at','>',\Carbon\Carbon::now()->startOfDay())->get(); + + //$groupSurveyTasks = GroupTask::where('started',1)->where('name','GroupSurvey')->where('completed',1)->where('created_at','>',\Carbon\Carbon::now()->startOfDay())->get(); $groups = []; foreach($activeGroupTasks as $key => $ac_task){ - #GRABS THE CRYPTO TASK RATHER THAN THE CRYPTO INTRO TASK - $real_task = GroupTask::where('group_id',$ac_task->group_id)->whereIn('name',array('Cryptography',"GroupSurvey"))->whereIn('order',array(2,3))->first(); - - if(!$real_task->completed) - $groups[] = $real_task->group_id; + $groups[] = $ac_task->group_id; } - $groupMembers = User::whereIn('group_id',$groups)->get()->groupBy('group_id'); + //foreach($groupSurveyTasks as $key => $ac_task){ + //$groups[] = $ac_task->group_id; + //} + + $groupMembers = User::whereIn('group_id',$groups)->where('in_room',0)->get()->groupBy('group_id'); $time_remaining = null; + $session_length = null; + + + //IF SESSION IS ACTIVE, DISPLAY TIMER INDICATING COUNTDOWN TO NEXT SUBSESSION + if($admin->waiting == 2){ + $task_length = env('MEMORY_TASK_LENGTH',300); + + $intro_length = env('MEMORY_INTRO_LENGTH',300); + + $alt_intro_length = env('MEMORY_ALT_INTRO_LENGTH',30); + + } + else{ + $task_length = env('CRYPTO_TASK_LENGTH',300); + + $intro_length = env('CRYPTO_INTRO_LENGTH',300); + + $alt_intro_length = env('CRYPTO_ALT_INTRO_LENGTH',30); + + } + + $survey_length = env('SURVEY_LENGTH',120); + $buffer_length = env('BUFFER_LENGTH',30); if($admin->current_session){ - $session_start = \Teamwork\Time::where('type','session')->orderBy('created_at','desc')->first(); + if($admin->current_session != 1 or $admin->waiting >= 4){ + $session_start = \Teamwork\Time::where('type','session')->orderBy('created_at','desc')->first(); - $time_elapsed = $session_start->created_at->diffInSeconds(\Carbon\Carbon::now()); - - $task_length = env('TASK_LENGTH',300); + $time_elapsed = $session_start->created_at->diffInSeconds(\Carbon\Carbon::now()); - $survey_length = env('SURVEY_LENGTH',120); + $alt_task_length = $task_length - $intro_length + $alt_intro_length; - $buffer_length = env('BUFFER_LENGTH',30); + $session_length = $alt_task_length + $survey_length + $buffer_length; + + $first_session_length = $task_length + $survey_length + $buffer_length; + + $time_remaining = $first_session_length + ($session_length * ($admin->current_session-1)) - $time_elapsed; + } + else{ + $session_start = \Teamwork\Time::where('type','session')->orderBy('created_at','desc')->first(); - $session_length = $task_length + $survey_length + $buffer_length; + $time_elapsed = $session_start->created_at->diffInSeconds(\Carbon\Carbon::now()); - $time_remaining = ($session_length * $admin->current_session) - $time_elapsed; + $session_length = $task_length + $survey_length + $buffer_length; - $total_time = $session_length * $admin->max_sessions; + $time_remaining = ($session_length * $admin->current_session) - $time_elapsed; + } + + } + else{ + $time_remaining = NULL; } return view('layouts.participants.admin-page') @@ -223,6 +297,8 @@ public function adminPage(Request $request){ ->with('in_session',$in_session) ->with('waitingRoomMembers',$waitingRoomMembers) ->with('groupMembers',$groupMembers) + ->with('admin',$admin) + ->with('subsession_length',$session_length) ->with('time_remaining',$time_remaining); } @@ -243,7 +319,6 @@ public function toggleSession(Request $request){ #FORCE PARTICIPANT PAGE TO REFRESH public function forceRefreshUser($id, Request $request){ - $this_user = User::where('participant_id',$id)->first(); @@ -296,13 +371,16 @@ public function setActive(Request $request){ #BEGIN 1-4 ROUND SESSION WITH CURRENT USERS IN WAITING ROOM public function beginSession(Request $request){ - #IF THERE AREN'T AT LEAST 1 LEADERS AND 2 FOLLOWERS IN WAITING ROOM, DON'T START SESSION + #IF THERE AREN'T AT LEAST 3 IN WAITING ROOM, DON'T START SESSION $leaders = User::where('in_room',1)->where('id','!=',1)->where('status','Active')->where('group_role','leader')->orderBy('waitnum','desc')->get(); $members = User::where('in_room',1)->where('id','!=',1)->where('status','Active')->where('group_role','!=','leader')->orderBy('waitnum','desc')->get(); - if(count($leaders) < 1 || count($members) < 2) + $parts = User::where('in_room',1)->where('id','!=',1)->where('status','Active')->orderBy('waitnum','desc')->get(); + if(count($parts) < 3) return 'NO'; $admin = User::where('id',1)->first(); + if(!is_null($admin->current_session)) + return 'NO'; $admin->current_session = 0; $admin->max_sessions = $request->num_sessions; $admin->save(); @@ -310,18 +388,55 @@ public function beginSession(Request $request){ $time = \Teamwork\Time::create(['user_id' => \Auth::user()->id, 'type' => 'session']); $time->recordStartTime(); - $task_length = env('TASK_LENGTH',300); + //IF SESSION IS ACTIVE, DISPLAY TIMER INDICATING COUNTDOWN TO NEXT SUBSESSION + if($admin->waiting == 2){ + + $task_length = env('MEMORY_TASK_LENGTH',300); + + $survey_length = env('SURVEY_LENGTH',120); - $survey_length = env('SURVEY_LENGTH',120); + $buffer_length = env('BUFFER_LENGTH',30); - $buffer_length = env('BUFFER_LENGTH',30); + $intro_length = env('MEMORY_INTRO_LENGTH',300); + + $alt_intro_length = env('MEMORY_ALT_INTRO_LENGTH',300); + } + else{ + $task_length = env('CRYPTO_TASK_LENGTH',300); + + $survey_length = env('SURVEY_LENGTH',120); + + $buffer_length = env('BUFFER_LENGTH',30); + + $intro_length = env('CRYPTO_INTRO_LENGTH',300); + + $alt_intro_length = env('CRYPTO_ALT_INTRO_LENGTH',300); + } + + $alt_task_length = $task_length - $intro_length + $alt_intro_length; + + //$task_length -= $intro_length; $session_length = $task_length + $survey_length + $buffer_length; + $alt_session_length = $alt_task_length+ $survey_length + $buffer_length; + for($i=0; $i<$request->num_sessions; $i++){ - (new AssignGroups(''))->dispatch('')->delay(\Carbon\Carbon::now()->addSeconds($session_length * $i)); + if($i == 0){ + (new AssignGroups('',$admin->waiting))->dispatch('',$admin->waiting); + } + elseif($i == 1){ + (new AssignGroups('',$admin->waiting))->dispatch('',$admin->waiting)->delay(\Carbon\Carbon::now()->addSeconds($session_length)); + } + else{ + (new AssignGroups('',$admin->waiting))->dispatch('',$admin->waiting)->delay(\Carbon\Carbon::now()->addSeconds($alt_session_length * ($i-1) + $session_length)); + } + + } + event(new SessionBegun($admin)); + return '200'; @@ -363,8 +478,12 @@ public function sendGroupToWaitingRoom(Request $request,$participant_id){ #GET PARTICIPANT'S ROLE public function getRole(Request $request){ - $user = User::where('id',$request->id)->first(); - return $user->group_role; + + $user_id = \Auth::user()->id; + $user = User::where('id',$user_id)->first(); + $currentTask = GroupTask::where('group_id',$user->group_id)->where('completed',0)->orderBy('order','asc')->first(); + $user->task_name = $currentTask->name; + return $user; } #DISPLAYS 'CLOSED' PAGE TO PARTICIPANTS @@ -404,7 +523,7 @@ public function clearRoom(Request $request){ $admin->max_sessions = null; $admin->save(); - $group_tasks = GroupTask::where('name','Cryptography')->get(); + $group_tasks = GroupTask::whereIn('name',array('Cryptography','Memory','WaitingRoom','GroupSurvey','Conclusion'))->get(); foreach($group_tasks as $key => $gt){ $gt->completed = 1; @@ -422,6 +541,76 @@ public function clearRoom(Request $request){ return redirect('/admin-page'); } + #SEND PARTICIPANT TO CONCLUSION AND BOOT THEIR PARTNERS FROM THE TASK + public function forceConclusion($id,Request $request){ + + $admin = User::where('id',1)->first(); + $user = User::where('participant_id',$id)->first(); + + if($admin->waiting >= 2) + $qualtrics_type = 'qualtrics'; + else + $qualtrics_type = 'memory'; + + if($user->in_room){ + $g = new Group; + $g->save(); + $user->group_id = $g->id; + $user->current_session = 2; + $user->in_room = 0; + $user->save(); + + \Teamwork\GroupTask::initializeConclusionTasks($user->group_id,$randomize=false,$qualtrics_type); + + event(new SendToTask($user)); + } + else{ + $currentTask = GroupTask::where('group_id',$user->group_id)->where('completed',0)->orderBy('order','asc')->first(); + + + + + + $group_tasks = GroupTask::whereIn('name',array('Cryptography','Memory','GroupSurvey','Intro','DeviceCheck','Consent'))->where('group_id',$user->group_id)->get(); + + foreach($group_tasks as $key => $gt){ + $gt->completed = 1; + $gt->save(); + } + + $teammates = User::where('group_id',$user->group_id)->where('id','!=',$user->id)->get(); + + foreach($teammates as $key => $w){ + $w->current_session = 2; + $g = new Group; + $g->save(); + $w->group_id = $g->id; + $w->save(); + if($admin->current_session == $admin->max_sessions){ + \Teamwork\GroupTask::initializeConclusionTasks($w->group_id,$randomize=false,'qualtrics'); + } + else{ + \Teamwork\GroupTask::initializeCryptoWaitingRoomTasks($w->group_id,$randomize=false); + } + + event(new EndSubsession($w,$currentTask->order)); + } + + $g = new Group; + $g->save(); + $user->group_id = $g->id; + $user->current_session = 2; + $user->save(); + + \Teamwork\GroupTask::initializeConclusionTasks($user->group_id,$randomize=false,'error'); + + event(new EndSubsession($user,$currentTask->order)); + } + + + return '200'; + } + #SAVE NOTE FOR USER-SESSION IN HISTORICAL DATA TABLE public function saveNotes(Request $request){ @@ -434,6 +623,15 @@ public function saveNotes(Request $request){ return '200'; } + #TOGGLE SESSION TASK TYPE + public function setTaskType(Request $request){ + $admin = User::find(1); + $admin->waiting = (int) $request->type; + $admin->save(); + + return '200'; + } + #DISPLAY MAIN ADMIN MENU public function adminMenu(Request $request){ return view('layouts.participants.admin-menu'); diff --git a/app/Jobs/AssignGroups.php b/app/Jobs/AssignGroups.php index e3ac1cb5..24244c96 100644 --- a/app/Jobs/AssignGroups.php +++ b/app/Jobs/AssignGroups.php @@ -9,6 +9,7 @@ use Illuminate\Foundation\Bus\Dispatchable; use Teamwork\User; use Teamwork\Group; +use Teamwork\Response; use Teamwork\Events\SendToTask; use Teamwork\Events\EndSubsession; use Teamwork\Events\AlertWaiter; @@ -31,8 +32,9 @@ class AssignGroups implements ShouldQueue * * @return void */ - public function __construct(String $id){ + public function __construct(String $id,int $task ){ $this->id = $id; + $this->task = $task; } /** @@ -52,13 +54,104 @@ public function handle() //LOOP UNTIL < 3 USERS IN WAITING ROOM ARE UNASSIGNED - //ONLY CRYPTO FOR NOW - $task = 1; + $task = $this->task; + Log::debug('Task is '.$task); //GET ACTIVE WAITING ROOM MEMBERS $in_room = User::where('in_room',1)->where('id','!=',1)->where('status','Active')->get()->shuffle(); + foreach($in_room as $key => $roomie){ + $roomie->group_role = ''; + $roomie->save(); + } + if(count($in_room) >= 3){ + Log::debug('first condition met'); + + $choosers = []; + $chosen = []; + + foreach($in_room as $key => $user){ + $res = Response::where('prompt','role_select')->where('user_id',$user->id)->first(); + if($res) + $choosers[] = $user->id; + else + $chosen[] = $user->id; + } + + $choosers = User::whereIn('id',$choosers)->get(); + $choosers = $choosers->shuffle(); + $chosen = User::whereIn('id',$chosen)->get(); + $chosen = $chosen->shuffle(); + + + Log::debug(count($choosers)); + Log::debug(count($chosen)); + Log::debug($choosers); + Log::debug($chosen); + Log::debug('log'); + + foreach($choosers as $key => $chooser){ + $res = Response::where('prompt','role_select')->where('user_id',$chooser->id)->first(); + + if($res->response == 'leader'){ + $flip = random_int(0,2); + Log::debug($chooser->participant_id.'\'s Flip = '.$flip); + + if($flip == 0){ + $chooser->group_role = "follower"; + } + else{ + $chooser->group_role = 'leader'; + } + } + else{ + $flip = random_int(0,2); + Log::debug($chooser->participant_id.'\'s Flip = '.$flip); + if($flip == 0){ + $chooser->group_role = "leader"; + } + else{ + $chooser->group_role = 'follower'; + } + } + + $chooser->save(); + } + + $room_size = count($in_room); + $num_groups = intdiv($room_size,3); + + + $leaders = User::where('in_room',1)->where('id','!=',1)->where('status','Active')->where('group_role','leader')->orderBy('waitnum','desc')->get(); + $members = User::where('in_room',1)->where('id','!=',1)->where('status','Active')->where('group_role','!=','leader')->orderBy('waitnum','desc')->get(); + + if(count($leaders) > $num_groups){ + for($i = 0; $i < $count($leaders) - $num_groups; $i++){ + $follower = $leaders->pop(); + $follower->group_role = "follower"; + $follower->save(); + } + } + + $leaders = User::where('in_room',1)->where('id','!=',1)->where('status','Active')->where('group_role','leader')->orderBy('waitnum','desc')->get(); + $members = User::where('in_room',1)->where('id','!=',1)->where('status','Active')->where('group_role','!=','leader')->orderBy('waitnum','desc')->get(); + + $leaders_left = $num_groups - count($leaders); + $members_left = $num_groups*2 - count($members); + + foreach($chosen as $key => $cho){ + if($leaders_left > 0){ + $cho->group_role = 'leader'; + $cho->save(); + $leaders_left -= 1; + } + elseif($members_left > 0){ + $cho->group_role = 'follower'; + $cho->save(); + $members_left -= 1; + } + } $leaders = User::where('in_room',1)->where('id','!=',1)->where('status','Active')->where('group_role','leader')->orderBy('waitnum','desc')->get(); $members = User::where('in_room',1)->where('id','!=',1)->where('status','Active')->where('group_role','!=','leader')->orderBy('waitnum','desc')->get(); @@ -74,6 +167,7 @@ public function handle() $waiter = $leaders->pop(); $leaderWaiters[] = $waiter->id; $waiter->waitnum += 1; + $waiter->current_session = 1; $waiter->save(); event(new AlertWaiter($waiter)); } @@ -81,6 +175,7 @@ public function handle() for($i = 0; $i < $memberWaiterNum; $i++){ $waiter = $members->pop(); $memberWaiters[] = $waiter->id; + $waiter->current_session = 1; $waiter->waitnum += 1; $waiter->save(); event(new AlertWaiter($waiter)); @@ -90,6 +185,7 @@ public function handle() $members = User::where('in_room',1)->where('id','!=',1)->where('status','Active')->where('group_role','!=','leader')->whereNotIn('id',$memberWaiters)->get()->shuffle(); while(count($leaders) > 0 && count($members) > 1){ + Log::debug('while loop begun'); //RANDOMLY ASSIGN ROLES FOR NOW $leader = $leaders->pop(); @@ -114,6 +210,17 @@ public function handle() $leader->group_id = $group->id; $follower1->group_id = $group->id; $follower2->group_id = $group->id; + $task_id = 1; + if($task == 3){ + $task_id = 3 + $admin->current_session - 1; + } + if($task == 4){ + $task_id = 7 + $admin->current_session - 1; + } + if($task == 5){ + $task_id = 11 + $admin->current_session - 1; + } + foreach([$leader,$follower1,$follower2] as $user){ //CREATES CROSS-TABLE LINK FROM USER TO GROUP @@ -128,42 +235,36 @@ public function handle() // Will throw an exception if the group ID and user ID are duplicates. Just ignore } - //SETS 'TASK_ID', WHICH DEFINES THE SET OF RULES FOR THE CRYPTO ROUND - //SET RANDOMLY AT FIRST, THEN ITERATES ONE BY ONE THROUGH THE 16 OPTIONS - if($user->task_id == 0) - $user->task_id = rand(1,16); - else - $user->task_id = (($user->task_id + 1) % 16) + 1; - - $user->save(); - } //ASSIGN APPROPRIATE TASKS TO THE GROUP if($task == 1){ - \Teamwork\GroupTask::initializeCryptoTasks($group->id,$randomize=false,$final=$admin->current_session == $admin->max_sessions); + \Teamwork\GroupTask::initializeCryptoTasks($group->id,$randomize=false,$final=$admin->current_session == $admin->max_sessions,$first=$admin->current_session == 1); $task_name = "Cryptography"; } elseif($task == 2){ - \Teamwork\GroupTask::initializeMemoryTasks($group->id,$randomize=false); + \Teamwork\GroupTask::initializeMemoryTasks($group->id,$randomize=false,$final=$admin->current_session == $admin->max_sessions,$test=$admin->current_session); $task_name = "Memory"; } else{ - \Teamwork\GroupTask::initializeEmptyTasks($group->id,$randomize=false,$final=$admin->current_session == $admin->max_sessions); - $task_name = "EmptyTask"; + \Teamwork\GroupTask::initializeCryptoWithIndividualTasks($group->id,$randomize=false,$final=$admin->current_session == $admin->max_sessions,$first=$admin->current_session == 1 and $task < 4); + $task_name = "Cryptography"; } //LINK GROUP TO TASK_ID, AKA SET OF RULES $group_task = \Teamwork\GroupTask::where('group_id',$group->id)->where('name',$task_name)->orderBy('order','DESC')->first(); Log::debug($group_task); Log::debug($leader); - $group_task->task_id = $leader->task_id; + $group_task->task_id = $task_id; $group_task->save(); //REMOVE USERS IN GROUP FROM WAITING ROOM $leader->in_room = 0; + $leader->current_session = 0; $follower1->in_room = 0; + $follower1->current_session = 0; $follower2->in_room = 0; + $follower2->current_session = 0; $leader->save(); $follower1->save(); $follower2->save(); @@ -325,18 +426,33 @@ public function handle() } + if($task != 2){ + $task_length = env('CRYPTO_TASK_LENGTH',300); + + $intro_length = env('CRYPTO_INTRO_LENGTH',30); + + $alt_intro_length = env('CRYPTO_ALT_INTRO_LENGTH'); + } + else{ + $task_length = env('MEMORY_TASK_LENGTH',300); + + $intro_length = env('MEMORY_INTRO_LENGTH',30); + + $alt_intro_length = env('MEMORY_ALT_INTRO_LENGTH',100); + } + //SETTING TIME VARIABLES FOR COUNTDOWNS $session_start = \Teamwork\Time::where('type','session')->orderBy('created_at','desc')->first(); $time_elapsed = $session_start->created_at->diffInSeconds(\Carbon\Carbon::now()); - $task_length = env('TASK_LENGTH',300); - $survey_length = env('SURVEY_LENGTH',120); $buffer_length = env('BUFFER_LENGTH',30); - $intro_length = env('INTRO_LENGTH',30); + if($admin->current_session != 1 or $task >= 4){ + $task_length = $task_length - $intro_length + $alt_intro_length; + } $session_length = $task_length + $survey_length + $buffer_length; @@ -345,34 +461,46 @@ public function handle() event(new SendToTask($follower1)); event(new SendToTask($follower2)); - //DISPATCHES DELAYED JOBS WHICH WILL FIRE EVENTS THAT SEND USERS FROM THE TASK TO THE WAITING ROOM/CONCLUSION - //AT THE END OF A SUBSESSION - (new SendIntroComplete($leader->id,2))->dispatch($leader->id,2)->delay(\Carbon\Carbon::now()->addSeconds($intro_length)); - (new SendIntroComplete($follower1->id,2))->dispatch($follower1->id,2)->delay(\Carbon\Carbon::now()->addSeconds($intro_length + 1)); - (new SendIntroComplete($follower2->id,2))->dispatch($follower2->id,2)->delay(\Carbon\Carbon::now()->addSeconds($intro_length + 2)); - - (new SendTaskComplete($leader->id,2))->dispatch($leader->id,2)->delay(\Carbon\Carbon::now()->addSeconds($session_length-($survey_length + $buffer_length))); - (new SendTaskComplete($follower1->id,2))->dispatch($follower1->id,2)->delay(\Carbon\Carbon::now()->addSeconds($session_length-($survey_length + $buffer_length + 1))); - (new SendTaskComplete($follower2->id,2))->dispatch($follower2->id,2)->delay(\Carbon\Carbon::now()->addSeconds($session_length-($survey_length + $buffer_length + 2))); - - (new SendTaskComplete($leader->id,3))->dispatch($leader->id,3)->delay(\Carbon\Carbon::now()->addSeconds($session_length-$buffer_length)); - (new SendTaskComplete($follower1->id,3))->dispatch($follower1->id,3)->delay(\Carbon\Carbon::now()->addSeconds($session_length-$buffer_length + 1)); - (new SendTaskComplete($follower2->id,3))->dispatch($follower2->id,3)->delay(\Carbon\Carbon::now()->addSeconds($session_length-$buffer_length + 2)); - - //(new SendTaskEvent($leader->id))->dispatch($leader->id)->delay(\Carbon\Carbon::now()->addSeconds($session_length-$buffer_length)); - //(new SendTaskEvent($follower1->id))->dispatch($follower1->id)->delay(\Carbon\Carbon::now()->addSeconds($session_length-$buffer_length -1)); - //(new SendTaskEvent($follower2->id))->dispatch($follower2->id)->delay(\Carbon\Carbon::now()->addSeconds($session_length-$buffer_length - 2)); - - //IF THIS IS THE LAST SUBSESSION, DISPATCH A DELAYED JOB TO FIRE "END OF SESSION" EVENTS - if($admin->current_session == $admin->max_sessions){ - (new SendSessionComplete($follower2->id))->dispatch($follower2->id)->delay(\Carbon\Carbon::now()->addSeconds($session_length)); - if(count($leaderWaiters) > 0 || count($memberWaiters) > 0){ - (new HandleStragglers($admin->id))->dispatch($admin->id); - } + if($admin->current_session == 1 and $task <= 3){ + //DISPATCHES DELAYED JOBS WHICH WILL FIRE EVENTS THAT SEND USERS FROM THE TASK TO THE WAITING ROOM/CONCLUSION + //AT THE END OF A SUBSESSION + (new SendIntroComplete($leader->id,1))->dispatch($leader->id,1)->delay(\Carbon\Carbon::now()->addSeconds($intro_length)); + (new SendIntroComplete($follower1->id,1))->dispatch($follower1->id,1)->delay(\Carbon\Carbon::now()->addSeconds($intro_length + 1)); + (new SendIntroComplete($follower2->id,1))->dispatch($follower2->id,1)->delay(\Carbon\Carbon::now()->addSeconds($intro_length + 2)); + + (new SendTaskComplete($leader->id,2))->dispatch($leader->id,2)->delay(\Carbon\Carbon::now()->addSeconds($session_length- ($survey_length + $buffer_length))); + (new SendTaskComplete($follower1->id,2))->dispatch($follower1->id,2)->delay(\Carbon\Carbon::now()->addSeconds($session_length - ($survey_length + $buffer_length) + 1)); + (new SendTaskComplete($follower2->id,2))->dispatch($follower2->id,2)->delay(\Carbon\Carbon::now()->addSeconds($session_length- ($survey_length + $buffer_length) + 2)); + + (new SendTaskComplete($leader->id,3))->dispatch($leader->id,3)->delay(\Carbon\Carbon::now()->addSeconds($session_length-$buffer_length)); + (new SendTaskComplete($follower1->id,3))->dispatch($follower1->id,3)->delay(\Carbon\Carbon::now()->addSeconds($session_length-$buffer_length + 1)); + (new SendTaskComplete($follower2->id,3))->dispatch($follower2->id,3)->delay(\Carbon\Carbon::now()->addSeconds($session_length-$buffer_length + 2)); + } + else{ + (new SendIntroComplete($leader->id,1))->dispatch($leader->id,1)->delay(\Carbon\Carbon::now()->addSeconds($alt_intro_length)); + (new SendIntroComplete($follower1->id,1))->dispatch($follower1->id,1)->delay(\Carbon\Carbon::now()->addSeconds($alt_intro_length + 1)); + (new SendIntroComplete($follower2->id,1))->dispatch($follower2->id,1)->delay(\Carbon\Carbon::now()->addSeconds($alt_intro_length + 2)); + + (new SendTaskComplete($leader->id,2))->dispatch($leader->id,2)->delay(\Carbon\Carbon::now()->addSeconds($session_length- ($survey_length + $buffer_length))); + (new SendTaskComplete($follower1->id,2))->dispatch($follower1->id,2)->delay(\Carbon\Carbon::now()->addSeconds($session_length - ($survey_length + $buffer_length) + 1)); + (new SendTaskComplete($follower2->id,2))->dispatch($follower2->id,2)->delay(\Carbon\Carbon::now()->addSeconds($session_length- ($survey_length + $buffer_length) + 2)); + + (new SendTaskComplete($leader->id,3))->dispatch($leader->id,3)->delay(\Carbon\Carbon::now()->addSeconds($session_length-$buffer_length)); + (new SendTaskComplete($follower1->id,3))->dispatch($follower1->id,3)->delay(\Carbon\Carbon::now()->addSeconds($session_length-$buffer_length + 1)); + (new SendTaskComplete($follower2->id,3))->dispatch($follower2->id,3)->delay(\Carbon\Carbon::now()->addSeconds($session_length-$buffer_length + 2)); } + + + } - + //IF THIS IS THE LAST SUBSESSION, DISPATCH A DELAYED JOB TO FIRE "END OF SESSION" EVENTS + if($admin->current_session == $admin->max_sessions){ + (new SendSessionComplete($follower2->id))->dispatch($follower2->id)->delay(\Carbon\Carbon::now()->addSeconds($session_length)); + if(count($leaderWaiters) > 0 || count($memberWaiters) > 0){ + (new HandleStragglers($admin->id))->dispatch($admin->id)->delay(\Carbon\Carbon::now()->addSeconds(10)); + } + } $group_session = Session::orderBy('created_at','desc')->first(); @@ -380,6 +508,8 @@ public function handle() foreach($leaderWaiters as $key => $id){ $leader = User::find($id); + $leader->task_id += 1; + $leader->save(); $leader_session = Session::where('participant_id',$leader->participant_id)->orderBy('created_at','desc')->where('session_id',$group_session->session_id)->first(); if(!$leader_session){ @@ -407,7 +537,8 @@ public function handle() foreach($memberWaiters as $key => $id){ $member = User::find($id); - + $member->task_id += 1; + $member->save(); $member_session = Session::where('participant_id',$member->participant_id)->orderBy('created_at','desc')->where('session_id',$group_session->session_id)->first(); if(!$member_session){ diff --git a/app/Jobs/HandleStragglers.php b/app/Jobs/HandleStragglers.php index 940f9eb0..1657ae7e 100644 --- a/app/Jobs/HandleStragglers.php +++ b/app/Jobs/HandleStragglers.php @@ -40,12 +40,21 @@ public function __construct(String $id){ */ public function handle() { - $in_room = User::where('in_room',1)->where('id','!=',1)->where('status','Active')->get(); + $in_room = User::where('id','!=',1)->where('status','Active')->where('current_session',1)->get(); $group = new Group; $group->save(); - \Teamwork\GroupTask::initializeConclusionTasks($group->id,$randomize=false); + $admin = User::find(1); + if($admin->waiting == 1){ + $qualtrics_type = 'qualtrics'.($admin->waiting - 2); + \Teamwork\GroupTask::initializeCryptoConclusionTasks($group->id,$randomize=false,$qualtrics_type); + } + else{ + $qualtrics_type = 'memory'; + \Teamwork\GroupTask::initializeConclusionTasks($group->id,$randomize=false,$qualtrics_type); + } + foreach($in_room as $key => $straggler){ $straggler->group_id = $group->id; diff --git a/app/Jobs/SendIntroComplete.php b/app/Jobs/SendIntroComplete.php index 71330c6f..b614e03e 100644 --- a/app/Jobs/SendIntroComplete.php +++ b/app/Jobs/SendIntroComplete.php @@ -40,9 +40,23 @@ public function __construct(String $id){ public function handle() { $this_user = User::find($this->id); - $group_task = GroupTask::where('group_id',$this_user->group_id)->where('name','Cryptography')->first(); - $group_task->completed = 1; - $group_task->save(); - event(new IntroEnding($this_user)); + $admin = User::find(1); + if($admin->waiting == 1) + $name = "Cryptography"; + if($admin->waiting == 2) + $name = "Memory"; + if($admin->waiting == 3) + $name = "Cryptography"; + if($admin->waiting == 4) + $name = "Cryptography"; + if($admin->waiting == 5) + $name = "Cryptography"; + $group_task = GroupTask::where('group_id',$this_user->group_id)->where('name',$name)->where('order',1)->first(); + if(!is_null($group_task)){ + $group_task->completed = 1; + $group_task->save(); + event(new IntroEnding($this_user)); + } + } } diff --git a/app/Tasks/Conclusion.php b/app/Tasks/Conclusion.php index 3233150d..5ad91bd6 100644 --- a/app/Tasks/Conclusion.php +++ b/app/Tasks/Conclusion.php @@ -12,17 +12,26 @@ class Conclusion { private $conclusions = [ 'mturk' => [[ 'type' => 'sub-header', - 'content' => 'You\'ve completed all the tasks!' + 'content' => 'You\'ve completed the group tasks for today\'s session!' ], [ 'type' => 'sub-header', - 'content' => 'The final step involves providing feedback and scheduling your next session. Once this is done, you\'ll enter your Prolific ID to get paid.' + 'content' => 'The final step involves providing feedback and entering your Prolific ID.' ], [ 'type' => 'sub-header', 'content' => 'Thank you for participating!' ] ], + 'individual_pilot' => [[ + 'type' => 'sub-header', + 'content' => 'You\'ve completed the individual tasks! Congratulations.' + ], + [ + 'type' => 'sub-header', + 'content' => 'The final step for today is to get a completion code in Qualtrics. Please click on the button below!' + ] + ], 'hdsl_individual' => [[ 'type' => 'header', 'content' => "Congratulations! You've finished the pilot." @@ -101,7 +110,14 @@ class Conclusion { 'pilot' => 'https://docs.google.com/forms/d/1ZZV8P_dyifFn4DRhalN82126POz3R-SgCWXvTo7DMaU/viewform?ts=5d35ccb7&edit_requested=true', 'group5Pilot' => 'https://docs.google.com/forms/d/1KNfcSCGmdNy4vqKtx2R8paFvSeklTfQyvtWBPaINRwk/viewform?usp=sharing_eip&ts=5d405d8c&edit_requested=true', 'groupTwo' => 'https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.google.com_forms_d_e_1FAIpQLSfL8x7CTs9I6vPreeXAdw5-2DURJMj5G17SqKZuMyCNC-5F1EQw1w_viewform-3Fusp-3Dsf-5Flink&d=DwMFaQ&c=WO-RGvefibhHBZq3fL85hQ&r=tAX8kL7P9f6gcapc67VgDbxuAn6xB0Zl7vfMQBORGpQ&m=23Mvsql-PxIiPW6hhQRvCrbd4sGrl4FDLjm7r5XrFVM&s=Xa0buQFFydQM--IKsMwZf0uuKzfcX4YiwTD54YkoiHE&e=', - 'qualtrics' => 'https://harvard.az1.qualtrics.com/jfe/form/SV_2tLibq6KB8AlxnE'#https://harvard.az1.qualtrics.com/jfe/form/SV_b7cZXgNyfCeTUB8' + 'qualtrics1' => 'https://harvard.az1.qualtrics.com/jfe/form/SV_egMFHEN94sz97RY',#https://harvard.az1.qualtrics.com/jfe/form/SV_b7cZXgNyfCeTUB8' + 'qualtrics2' => 'https://harvard.az1.qualtrics.com/jfe/form/SV_0vydNfrBkOZxvvw', + 'qualtrics3' => 'https://harvard.az1.qualtrics.com/jfe/form/SV_8exfwnu6eklv1Iy', + 'crypto_conclusion' => 'https://harvard.az1.qualtrics.com/jfe/form/SV_3BIo3gzw0SYdspg', + 'memory' => 'https://harvard.az1.qualtrics.com/jfe/form/SV_bveZ8a6KzLBtdn8', + 'individual_pilot' => 'https://harvard.az1.qualtrics.com/jfe/form/SV_5mrgmDl8AmQaYF8', + 'error' => 'https://harvard.az1.qualtrics.com/jfe/form/SV_4OXy4DDdEOqJA8K', + 'device' => 'https://harvard.az1.qualtrics.com/jfe/form/SV_emw9Id1JiuQsKEu' ]; private static $avaialbleParams = ['hasIndividuals' => ['true', 'false'], 'hasGroup' => ['false'], 'type' => ['mturk', 'hdsl_individual'], 'hasCode' => ['true', 'false'], 'feedback' => ['true', 'false']]; diff --git a/app/Tasks/Consent.php b/app/Tasks/Consent.php index 4fbc5754..e9d14abe 100644 --- a/app/Tasks/Consent.php +++ b/app/Tasks/Consent.php @@ -7,9 +7,9 @@ class Consent { - private $subjectPool = ['mturk', 'hdsl']; + private $subjectPool = ['mturk', 'hdsl','memory_pilot','individual_pilot']; - private static $avaialbleParams = ['subjectPool' => ['mturk', 'hdsl', 'hdsl_individual_pilot'], 'hasIndividuals' => ['true'], 'hasGroup' => ['false']]; + private static $avaialbleParams = ['subjectPool' => ['mturk', 'hdsl', 'hdsl_individual_pilot','memory_pilot','individual_pilot'], 'hasIndividuals' => ['true'], 'hasGroup' => ['false']]; public function getSubjectPool() { return $this->prompts; diff --git a/app/Tasks/GroupSurvey.php b/app/Tasks/GroupSurvey.php index f01de82c..5806f5f2 100644 --- a/app/Tasks/GroupSurvey.php +++ b/app/Tasks/GroupSurvey.php @@ -45,9 +45,7 @@ class GroupSurvey { ], '2' => [ ['question' => 'When someone made a mistake on this team, it was held against them', 'left_text' => 'Very untrue', 'right_text' => 'Very true'], - ['question' => 'It was safe to take a risk on this team', 'left_text' => 'Very untrue', 'right_text' => 'Very true'], ['question' => 'It was difficult to ask other members of this team for help', 'left_text' => 'Very untrue', 'right_text' => 'Very true'], - ['question' => 'Members of this team valued and respected each others\' contributions', 'left_text' => 'Very untrue', 'right_text' => 'Very true'], ['question' => 'Working with this team gave me a better understanding of how to perform this task', 'left_text' => 'Very untrue', 'right_text' => 'Very true'], ['question' => 'In this team, I felt comfortable suggesting or trying a new approach.', 'left_text' => 'Very untrue', 'right_text' => 'Very true'] ] diff --git a/app/Tasks/Intro.php b/app/Tasks/Intro.php index 523afd2b..964745a5 100644 --- a/app/Tasks/Intro.php +++ b/app/Tasks/Intro.php @@ -14,7 +14,7 @@ class Intro { ], [ 'type' => 'paragraph', - 'content' => 'Over the next 60-70 minutes you will complete a + 'content' => 'Over the next ~55 minutes you will complete a range of different tasks. Our goal is to understand how well you solve problems, your ability to perceive emotions in others, and your short-term memory. This is a research study @@ -53,19 +53,19 @@ class Intro { ], [ 'type' => 'paragraph', - 'content' => 'You will shortly go to a waiting room. Once the other participants have arrived, we will "allocate groups" to begin Round 1. If you are allocated to a group, you will solve a puzzle with 2 other people.' + 'content' => 'You will shortly go to a waiting room. Once the other participants have arrived, we will "allocate groups" to begin the first task. If you are allocated to a group, you will solve a puzzle with 2 other people.' ], [ 'type' => 'paragraph', - 'content' => 'Sometimes, not everyone will be allocated. If you are not in a group, stay in the waiting room and be ready for the next group allocation. The wait will be about 11 minutes. If you miss out, we try our best to make sure you are in a group in the next round.' + 'content' => 'Sometimes, not everyone will be allocated. If you are not in a group, stay in the waiting room and be ready for the next group allocation. The wait will be about 12-14 minutes. If you miss out, we try our best to make sure you are in a group in the next task.' ], [ 'type' => 'paragraph', - 'content' => 'Overall, there are 3 rounds. After each round, we ask you some questions about your teammates. Your answers are strictly confidential.' + 'content' => 'After each task, we ask you some questions about your teammates. Your answers are strictly confidential.' ], [ 'type' => 'paragraph', - 'content' => 'After the final round, there is also a survey about the experiment in general. As this is a pilot, please answer the questions as honestly and thoroughly as possible!' + 'content' => 'After the final task, there is also a survey about the experiment in general. These questions won\'t affect payments. Please answer them as honestly as possible!' ], [ 'type' => 'paragraph', @@ -131,6 +131,28 @@ class Intro {
' ] ], + 'no_notes' => [[ + 'type' => 'header', + 'content' => 'Reminder' + ], + [ + 'type' => 'paragraph', + 'content' => 'This session is trying to understand MEMORY.' + ], + [ + 'type' => 'paragraph', + 'content' => 'It is very important that you don\'t write anything down (or take any screenshots) during this experiment.' + ],[ + 'type' => 'paragraph', + 'content' => 'If anyone violates this rule, that person will not receive credit for participating in the study.' + ], + [ + 'type' => 'paragraph', + 'content' => '
+ Next +
' + ] + ], "part1_instructions" => [[ 'type' => 'header', @@ -257,13 +279,55 @@ class Intro { ], ], - 'adblock' => [[ + 'incognito' => [[ + 'type' => 'header', + 'content' => 'Important Note' + ], + [ + 'type' => 'paragraph', + 'content' => 'Warning: our study does NOT work with "incognito" or "private" browsers. If your current browser is in incognito/private mode, please copy the link below and reopen the study in a browser that is NOT incognito/private. If your browser is not incognito/private, just click Next.' + ], + [ + 'type' => 'paragraph', + 'content' => 'https://harvardskillslab.org/participant-login/individual-pilot' + ], + [ + 'type' => 'paragraph', + 'content' => '
+ Next +
' + ] + ], + 'incognito_p2' => [[ + 'type' => 'header', + 'content' => 'Important Note' + ], + [ + 'type' => 'paragraph', + 'content' => 'Warning: our study does NOT work with "incognito" or "private" browsers. If your current browser is in incognito/private mode, please copy the link below and reopen the study in a browser that is NOT incognito/private. If your browser is not incognito/private, just click Next.' + ], + [ + 'type' => 'paragraph', + 'content' => 'https://harvardskillslab.org/participant-login/phase-two' + ], + [ + 'type' => 'paragraph', + 'content' => '
+ Next +
' + ] + ], + 'incognito_p3' => [[ 'type' => 'header', 'content' => 'Important Note' ], [ 'type' => 'paragraph', - 'content' => 'This study is not compatible with the Adblock chrome extension, or other extensions like it. If you are using an ad blocker, make sure it is always disabled for this website. Otherwise, the study may not function correctly.' + 'content' => 'Warning: our study does NOT work with "incognito" or "private" browsers. If your current browser is in incognito/private mode, please copy the link below and reopen the study in a browser that is NOT incognito/private. If your browser is not incognito/private, just click Next.' + ], + [ + 'type' => 'paragraph', + 'content' => 'https://harvardskillslab.org/participant-login/phase-three' ], [ 'type' => 'paragraph', @@ -273,6 +337,22 @@ class Intro { ] ], + 'adblock' => [[ + 'type' => 'header', + 'content' => 'Important Note' + ], + [ + 'type' => 'paragraph', + 'content' => 'This study is not compatible with the Adblock chrome extension, or other extensions like it. If you are using an ad blocker, make sure it is always disabled for this website (not just this page), and refresh the page once you\'ve made the change. Otherwise, you will not be able to proceed with the study.' + ], + [ + 'type' => 'paragraph', + 'content' => '
+ +
' + ] + ], + 'crypto_pilot_guide' => [[ 'type' => 'header', @@ -300,31 +380,35 @@ class Intro { ], 'selection_page' => [[ 'type' => 'header', - 'content' => 'What Role would you choose?' + 'content' => 'What Role would you prefer?' ], [ 'type' => 'paragraph', - 'content' => 'You have now completed the individual tasks.' + 'content' => 'You have now completed the individual tasks.' ], [ 'type' => 'paragraph', - 'content' => 'Next, you will be working in a group with two other people. There are two roles: "Leader" or "Team member".' + 'content' => 'The rest of the study involves group tasks.
+ There are two roles in each group: "Leader" or "Team member".' ], + [ 'type' => 'paragraph', - 'content' => 'Your role *may* affect your payment
Team members get consistent payments.
Leaders earn the most, or the least (depending on team performance)
On average, both roles receive the same payment.' + 'content' => 'Leaders direct the group, and are responsible for answering questions.
+ - Leader bonus payments are based on group performance.
' ], [ 'type' => 'paragraph', - 'content' => 'There is not a single right answer. Pick the role that you think suits you best.' + 'content' => 'Team members are essential for group success.
+ - Team Member bonuses are fixed, regardless of group performance.
' ], [ 'type' => 'paragraph', - 'content' => 'If it were up to you, WHICH ROLE WOULD YOU PREFER?' + 'content' => 'Both roles receive the same payment on average.' ], [ 'type' => 'paragraph', - 'content' => 'Please note: we CANNOT guarantee that you will be allocated to your preferred option.' + 'content' => 'Pick the role that would suit you best.' ], [ 'type' => 'paragraph', @@ -334,6 +418,22 @@ class Intro {
' ] + ], + 'selection_followup' => [[ + 'type' => 'paragraph', + 'content' => 'Thanks! Your preference has been noted.' + ], + [ + 'type' => 'paragraph', + 'content' => 'Please be aware that you will NOT always get your preferred role.' + ], + [ + 'type' => 'paragraph', + 'content' => '
+ Next +
' + ] + ], 'individual_crypto_end' => [ [ diff --git a/app/Tasks/Memory.php b/app/Tasks/Memory.php index 5ab9e379..67b882e6 100644 --- a/app/Tasks/Memory.php +++ b/app/Tasks/Memory.php @@ -52,29 +52,33 @@ class Memory { 'header' => 'Image Memory', 'text' => 'In this task, you\'ll be presented with a set of images (for example, 6 faces). There will be 6 images to memorize. We\'ll - call these "target images". We\'ll start with a practice.',], + call these "target images". We\'ll start with a practice.'], ['type' => 'practice_review', 'text' => 'Look at these 6 faces for a few seconds. We\'ll call these "target faces".', + 'subtext' => 'Don\'t leave this page!', 'targets' => ['p0_targets_1.png'], 'review_time' => null], [ 'type' => 'practice_test', 'selection_type' => 'select_one', 'prompt' => 'Which of the following faces is a "target" face?', 'img' => 'p0_test_1.png', - 'correct' => [1]], + 'correct' => [1], + 'num' => 1], [ 'type' => 'practice_test', 'selection_type' => 'select_one', 'prompt' => 'Which of the following faces is a "target" face?', 'img' => 'p0_test_2.png', - 'correct' => [3]], + 'correct' => [3], + 'num' => 2], ['type' => 'text', 'text' => 'Now for the actual task. When you click "Continue" a screen will appear with 6 target images. You can view the images front-on or in profile. Click the "change perspective" button to see them from a different angle. You will have 20 seconds to memorize - these target images.'], + these target images.', + 'Do NOT take any screenshots, or write anything down.'], ]// end blocks ], // end images_instructions @@ -111,7 +115,6 @@ class Memory { you have read and understood the instructions, so please answer all questions carefully.',], ['type' => 'review', - 'text' => '', 'targets' => ['blue', 'yellow', 'red'], 'review_time_each' => 2, 'review_time' => null], @@ -119,14 +122,17 @@ class Memory { 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words?', 'choices' => ['red', 'rust', 'blue'], - 'correct' => [1, 3]], + 'correct' => [1, 3], + 'num' => 1 + ], [ 'type' => 'practice_test', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words?', 'choices' => ['green', 'baseball', 'egg'], 'correct' => [], 'popup_text' => 'Sometimes, none of the words will be a target word.
In that case, just click "next"!', - 'popup_display_time' => 5], + 'popup_display_time' => 5, + 'num' => 2], ['type' => 'text', 'text' => 'Now for the actual task. You will be presented with 12 target words. Try to remember all of them. Each word will @@ -161,30 +167,34 @@ class Memory { 'header' => 'Story Memory', 'text' => 'This memory task asks you to remember two very short stories. Once again, we’ll start with a - practice. In the practice round each "story" will only have one sentence.'], + practice. In the practice round each "story" will only have one sentence. + As always, you\'re not allowed to write anything down or take screenshots.'], ['type' => 'review', - 'text' => 'Practice:', - 'subtext' => 'Read these two \'stories\' quickly but carefully. When you\'re finished click continue.', + 'header' => 'Practice', + 'text' => 'You have 30 seconds to memorize the two "stories" presented below (there is a timer in the top right).', + 'subtext' => 'Don\'t leave this page!', 'targets' => ['Peter was hungry, so he went to the store on the corner of his street and bought a hamburger.', 'Yesterday, a local woman found a 10-foot crocodile in her kitchen, an event the fire department described as "unusual".'], - 'review_time' => null], + 'review_time' => 30], [ 'type' => 'practice_test', 'selection_type' => 'select_one', 'prompt' => 'Why did Peter go to the store?', 'choices' => ['Because he was hungry', 'To get coffee', 'To buy food for his dog'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 1], [ 'type' => 'practice_test', 'selection_type' => 'select_one', 'prompt' => 'Where was a crocodile found yesterday?', 'choices' => ['In a kitchen', 'On a roof in Manhattan', 'On the moon'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 2], ['type' => 'text', 'text' => 'Now for the actual task. You will be presented with two longer stories. You will have 30 seconds to read them. Try to take in as much information as possible. @@ -215,7 +225,7 @@ class Memory { 'directory' => '/img/memory-task/faces/', 'blocks' => [ ['type' => 'review', - 'text' => '', + 'text' => 'Note: do not leave this page!', 'targets' => ['1_targets_1.png', '1_targets_2.png', '1_targets_3.jpg'], 'review_time' => 20,], [ 'type' => 'test', @@ -223,55 +233,64 @@ class Memory { 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" face?', 'img' => '1_test_1.jpg', - 'correct' => [3]], + 'correct' => [3], + 'num' => 1], ['type' => 'test', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" face?', 'img' => '1_test_2.jpg', - 'correct' => [3]], + 'correct' => [3], + 'num' => 2], ['type' => 'test', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" face?', 'img' => '1_test_3.jpg', - 'correct' => [1]], + 'correct' => [1], + 'num' => 3], ['type' => 'test', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" face?', 'img' => '1_test_4.jpg', - 'correct' => [1]], + 'correct' => [1], + 'num' => 4], ['type' => 'test', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" face?', 'img' => '1_test_5.jpg', - 'correct' => [3]], + 'correct' => [3], + 'num' => 5], ['type' => 'test', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" face?', 'img' => '1_test_6.jpg', - 'correct' => [2]], + 'correct' => [2], + 'num' => 6], ['type' => 'test', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" face?', 'img' => '1_test_7.jpg', - 'correct' => [3]], + 'correct' => [3], + 'num' => 7], ['type' => 'test', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" face?', 'img' => '1_test_8.jpg', - 'correct' => [3]], + 'correct' => [3], + 'num' => 8], ['type' => 'test', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" face?', 'img' => '1_test_9.jpg', - 'correct' => [1]], + 'correct' => [1], + 'num' => 9], ['type' => 'review', 'text' => 'Here’s a reminder of the faces. @@ -291,37 +310,43 @@ class Memory { 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" face?', 'img' => '1_test_10.jpg', - 'correct' => [1]], + 'correct' => [1], + 'num' => 10], ['type' => 'test', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" face?', 'img' => '1_test_11.jpg', - 'correct' => [3]], + 'correct' => [3], + 'num' => 11], ['type' => 'test', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following faces is a "target" face?', 'img' => '1_test_12.jpg', - 'correct' => [3]], + 'correct' => [3], + 'num' => 12], ['type' => 'test', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" face?', 'img' => '1_test_13.jpg', - 'correct' => [2]], + 'correct' => [2], + 'num' => 13], ['type' => 'test', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" face?', 'img' => '1_test_14.jpg', - 'correct' => [1]], + 'correct' => [1], + 'num' => 14], ['type' => 'test', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" face?', 'img' => '1_test_15.jpg', - 'correct' => [2]], + 'correct' => [2], + 'num' => 15], ], // End blocks @@ -527,42 +552,50 @@ class Memory { 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['house', 'tiger', 'hut'], - 'correct' => [2, 3]], + 'correct' => [2, 3], + 'num' => 1], ['type' => 'test', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['hotel', 'coffee', 'mountain'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 2], ['type' => 'test', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['cow', 'dog', 'emerald'], - 'correct' => [1, 3]], + 'correct' => [1, 3], + 'num' => 3], ['type' => 'test', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['ruby', 'pig', 'balloon'], - 'correct' => []], + 'correct' => [], + 'num' => 4], ['type' => 'test', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['apartment', 'tiger', 'diamond'], - 'correct' => [2]], + 'correct' => [2], + 'num' => 5], ['type' => 'test', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['pearl', 'scarf', 'hotel'], - 'correct' => [1, 3]], + 'correct' => [1, 3], + 'num' => 6], ['type' => 'test', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['boat', 'penny', 'cat'], - 'correct' => []], + 'correct' => [], + 'num' => 7], ['type' => 'test', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['lion', 'sapphire', 'cave'], - 'correct' => [1, 2, 3]], + 'correct' => [1, 2, 3], + 'num' => 8], ] // End blocks @@ -767,56 +800,64 @@ class Memory { 'choices' => ['State Street', 'Main Street', 'Sixth Street'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 1], [ 'type' => 'test', 'selection_type' => 'select_one', 'prompt' => 'In which town was an attack stopped by an umbrella?', 'choices' => ['Greensville', 'Gainessville', 'Greensboro'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 2], [ 'type' => 'test', 'selection_type' => 'select_one', 'prompt' => 'How old was the woman who defended herself with an umbrella?', 'choices' => ['56', '57', '67'], - 'correct' => [2]], + 'correct' => [2], + 'num' => 3], [ 'type' => 'test', 'selection_type' => 'select_one', 'prompt' => 'What was Anna Thompson\'s job?', 'choices' => ['Cook', 'She didn\'t have a job', 'Janitor'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 4], [ 'type' => 'test', 'selection_type' => 'select_one', 'prompt' => 'When did Anna report being robbed?', 'choices' => ['One night after the robbery', 'Two nights after the robbery', 'A week after the robbery'], - 'correct' => [2]], + 'correct' => [2], + 'num' => 5], [ 'type' => 'test', 'selection_type' => 'select_one', 'prompt' => 'How long had it been since Anna\'s family had eaten?', 'choices' => ['2 days', '1 day', 'They missed 2 meals'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 6], [ 'type' => 'test', 'selection_type' => 'select_one', 'prompt' => 'What color was the pickup truck used by the attackers in Florida?', 'choices' => ['Yellow', 'Black', 'It wasn\'t mentioned'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 7], [ 'type' => 'test', 'selection_type' => 'select_one', 'prompt' => 'What did the police do to help Anna Thompson?', 'choices' => ['Make arrests', 'Collect money for her', 'Give her food'], - 'correct' => [2]], + 'correct' => [2], + 'num' => 8], ] // End blocks ], // End story_1 @@ -1066,11 +1107,13 @@ class Memory { 'directory' => '/img/memory-task/bodies/', 'blocks' => [ ['type'=>'text', - 'header'=> 'Welcome to the final set of group tasks!', + 'header'=> 'Welcome to the Group Memory task', 'wait_for_all'=>'true', 'text'=>[ - 'You will be working together for 10-12 minutes, trying to solve the COLLECTIVE MEMORY task.', - 'Please take a moment to introduce yourselves.' + 'Note that your group has 5 minutes to work through these instructions (including a practice question).', + 'Your time has already begun!', + 'Only the group Leader has information about the time remaining.', + 'Click next to continue.' ] ], ['type'=>'text', @@ -1078,17 +1121,25 @@ class Memory { 'wait_for_all'=>'true', 'text'=>[ 'This task is similar to the memory tasks you completed as an individual.', - 'Now, you will be working on the task as a group' + 'Now, you will be working on the task as a group.' + ] + ], + + ['type'=>'text', + 'header'=> 'Reminder', + 'wait_for_all'=>'true', + 'text'=>[ + 'It is very important that you don\'t write anything down during this task (or take any screenshots).', + 'If anyone is found to have violated this rule, the whole group will not receive credit for this study. Please remember that the study is being recorded.' ] ], ['type'=>'text', 'header'=> '', 'wait_for_all'=>'true', 'text'=>[ - "The collective Memory task examines three types of memory: images, words, and stories", - 'Your group must memorize all three types of stimuli at the same time', - "Please do NOT write anything down during this task", - "We'll start with a practice round" + "The collective Memory task examines three types of memory: images, words, and stories.", + 'Your group must memorize all three types of stimuli at the same time.', + "We'll start with a practice round." ] ], ['type' => 'text', @@ -1099,19 +1150,17 @@ class Memory { 3 images, 6 words, and 2 very short stories.', 'During the memorization period, each person can look at whatever stimulus they like', - 'Reminder: You are NOT allowed to write anything down.' + 'Reminder: You are NOT allowed to write anything down, or take any screenshots.' ]], ['type' => 'review_choice', 'header' => 'Practice Round', - 'text' => ['This is the page where you can choose what to memorize..', + 'text' => ['This is the page where you can choose what to memorize.', 'If you want, you can try to memorize several types of stimuli. For example, you might start with "Stories" (by clicking on the Stories button). Then, if you have time, you can click on a different button and try to memorize the Words and/or the Images.', - 'Take a minute to discuss with your group how you\'ll - approach this task.', 'Recall: in this practice round there are 6 words; 3 images; and 2 very short stories.', 'Your 20 seconds will begin when everyone in the group has @@ -1156,19 +1205,19 @@ class Memory { 'end_individual_section' => 'true', 'wait_for_all' => 'true', 'role' =>True, - 'leader' => ['Now we will ask you some questions about the stimuli.', - 'You are the leader and are responsible for answering on behalf of the group.', - 'The practice questions will begin when you all click next' + 'leader' => ['Next, we will ask you 3 questions about the stimuli.', + 'As the leader, you are the only person who can answer the questions. *This will be your responsibility.*', + 'The practice questions will begin when you all click next.' ], - 'follower1' => ['Now we will ask you some questions about the stimuli.', + 'follower1' => ['Next, we will ask you 3 questions about the stimuli.', 'You will see the questions on your computer.', - "Your group leader will answer on the group's behalf", - 'The practice questions will begin when you all click next' + "Your group leader will answer on the group's behalf.", + 'The practice questions will begin when you all click next.' ], - 'follower2' => ['Now we will ask you some questions about the stimuli.', + 'follower2' => ['Next, we will ask you 3 questions about the stimuli.', 'You will see the questions on your computer.', - "Your group leader will answer on the group's behalf", - 'The practice questions will begin when you all click next' + "Your group leader will answer on the group's behalf.", + 'The practice questions will begin when you all click next.' ]], ['type' => 'practice_test_stories', @@ -1177,20 +1226,32 @@ class Memory { 'choices' => ['100', '150', '125'], - 'correct' => [3]], + 'correct' => [3], + 'num' => 1], [ 'type' => 'practice_test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words?', 'choices' => ['bread', 'fish', 'pie'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 2], [ 'type' => 'practice_test_images', 'selection_type' => 'select_one', 'show_numbers' => 'false', 'prompt' => 'Which of the following images is a "target" image?', 'img' => 'p0_test_1.jpeg', - 'correct' => [1]], + 'correct' => [1], + 'num' => 3], + ['type'=>'text', + 'header'=> 'Wait for task to begin', + 'wait_for_all'=>'true', + 'no_proceed'=>'true', + 'text'=>[ + 'The task will begin shortly (when the timer on the Leader\'s screen reaches 0:00).', + 'Until then, please stay on this page and chat with your teammates!' + ] + ] ]// end blocks ], // end group_1_instructions @@ -1201,6 +1262,251 @@ class Memory { 'type' => 'intro', 'directory' => '/img/memory-task/faces/', 'wait_for_all'=>'true', + 'blocks' => [ + ['type' => 'text', + 'header' => 'Memory Task', + 'wait_for_all' => 'true', + 'no_proceed' => 'true', + 'text' => ['Welcome to your new group. In this task, you will work together to memorize a set of images, words and stories -- and then answer questions about these stimuli.', + "Many of you will have seen a very similar task before in a previous group.", + 'There is a timer on your Leader\'s screen.', + 'The task will begin shortly (when the timer on the Leader\'s screen reaches 0:00).', + 'Until then, please stay on this page and chat with your teammates!' + ]], + + /* WE ARE SKIPPING THE PRACTICE FOR THIS GROUP FOR NOW + ['type' => 'text', + 'header' => 'Memory: practice round', + 'wait_for_all' => 'true', + 'text' => ['This practice round will not count toward your group’s score.', + 'Your group has 20 seconds to memorize + 3 images, 6 words, and + 2 very short stories.', + 'During the memorization period, each person will look at + their own laptop and try to memorize as much as they can. + It is possible, but difficult, for one person to remember + all three types of stimuli.', + 'There will be final instructions when all three group + members have clicked "Next".' + ]], + ['type' => 'review_choice', + 'header' => 'Practice Round', + 'text' => ['This is the page where you can choose what to memorize. + We will ask your group about all three types of stimuli: + Images, Words and Stories.', + 'If you want, you can try to memorize several types of stimuli. + For example, you might start with "Stories" (by clicking + on the Stories button). + Then, if you have time, you can click on a different button and + try to memorize the Words + and/or the Images. + Alternatively, each group member can focus on memorizing + one type of stimulus.', + 'Take a minute to discuss with your group how you\'ll + approach this task.', + 'Reminder: in this practice round there + are 6 words; 3 images; and 2 very short stories.', + 'Your 20 seconds will begin when everyone in the group has + clicked on a button below. There is a timer in the top + right of the screen'], + 'choices' => [['color' => 'success', 'type' => 'images'], + ['color' => 'warning', 'type' => 'words'], + ['color' => 'danger', 'type' => 'stories']], + 'review_time' => 20], + + ['type' => 'mixed_review', + 'text' => [], + 'types' => [ + ['type' => 'images', 'directory' => '/img/memory-task/faces/', + 'prompt' => 'Remember these target images', + 'targets' => ['1_targets_1.png', '1_targets_2.png', '1_targets_3.jpg'] + ], + ['type' => 'words', + 'prompt' => 'Remember these target words', + 'targets' => ['tree', 'pine', 'root', 'glove', 'baseball', 'hotdog'] + ], + ['type' => 'stories', + 'prompt' => 'Remember these target stories', + 'targets' => ['The oldest surviving human, who was born in + 1902, recently identified her secret to long life, + citing the benefits of swimming every day in very + cold water.', + 'A poll, conducted a week ago by Pew Research, + found that 60% of people prefer vanilla icecream + to chocolate. Critics suggest that the poll + was biased.'], + ] + ], + 'choices' => [['color' => 'success', 'type' => 'images'], + ['color' => 'warning', 'type' => 'words'], + ['color' => 'danger', 'type' => 'stories']], + 'review_time' => 20], + + ['type' => 'text', + 'header' => 'Memory: practice round', + 'end_individual_section' => 'true', + 'text' => ['Now we will ask you some questions about the stimuli. + Remember, this is a practice!

+ You will answer as a group. When you’re answering the + questions everyone should be able to see the Reporter\'s + laptop.

+ If you are not the Reporter, leave your laptop open. You\'ll + come back to it shortly.

+ The practice questions will begin when The Reporter clicks "Next"' + ]], + + [ 'type' => 'practice_test_words', + 'selection_type' => 'select_all', + 'prompt' => 'Which of the following are target words?', + 'choices' => ['tree', 'pine', 'grow'], + 'correct' => [1, 2]], + + ['type' => 'practice_test_stories', + 'selection_type' => 'select_one', + 'prompt' => 'What year was the oldest known human born?', + 'choices' => ['1901', + '1902', + '1903'], + 'correct' => [2]], + + [ 'type' => 'practice_test_images', + 'selection_type' => 'select_one', + 'show_numbers' => 'false', + 'prompt' => 'Which of the following images is a "target" image?', + 'img' => '1_test_1.jpg', + 'correct' => [3]], + */ + ]// end blocks + ], // end group_2_instructions + + 'group_3_instructions' => [ + 'test_name' => 'group_3_instructions', + 'task_type' => 'mixed', + 'type' => 'intro', + 'directory' => '/img/memory-task/faces/', + 'wait_for_all'=>'true', + 'blocks' => [ + ['type' => 'text', + 'header' => 'Memory Task', + 'wait_for_all' => 'true', + 'no_proceed' => 'true', + 'text' => ['Welcome to your new group. In this task, you will work together to memorize a set of images, words and stories -- and then answer questions about these stimuli.', + "Many of you will have seen a very similar task before in a previous group.", + 'There is a timer on your Leader\'s screen.', + 'The task will begin shortly (when the timer on the Leader\'s screen reaches 0:00).', + 'Until then, please stay on this page and chat with your teammates!' + ]], + /* WE ARE SKIPPING THE PRACTICE FOR THIS GROUP FOR NOW + ['type' => 'text', + 'header' => 'Memory: practice round', + 'wait_for_all' => 'true', + 'text' => ['This practice round will not count toward your group’s score.', + 'Your group has 20 seconds to memorize + 3 images, 6 words, and + 2 very short stories.', + 'During the memorization period, each person will look at + their own laptop and try to memorize as much as they can. + It is possible, but difficult, for one person to remember + all three types of stimuli.', + 'There will be final instructions when all three group + members have clicked "Next".' + ]], + ['type' => 'review_choice', + 'header' => 'Practice Round', + 'text' => ['This is the page where you can choose what to memorize. + We will ask your group about all three types of stimuli: + Images, Words and Stories.', + 'If you want, you can try to memorize several types of stimuli. + For example, you might start with "Stories" (by clicking + on the Stories button). + Then, if you have time, you can click on a different button and + try to memorize the Words + and/or the Images. + Alternatively, each group member can focus on memorizing + one type of stimulus.', + 'Take a minute to discuss with your group how you\'ll + approach this task.', + 'Reminder: in this practice round there + are 6 words; 3 images; and 2 very short stories.', + 'Your 20 seconds will begin when everyone in the group has + clicked on a button below. There is a timer in the top + right of the screen'], + 'choices' => [['color' => 'success', 'type' => 'images'], + ['color' => 'warning', 'type' => 'words'], + ['color' => 'danger', 'type' => 'stories']], + 'review_time' => 20], + + ['type' => 'mixed_review', + 'text' => [], + 'types' => [ + ['type' => 'images', 'directory' => '/img/memory-task/faces/', + 'prompt' => 'Remember these target images', + 'targets' => ['1_targets_1.png', '1_targets_2.png', '1_targets_3.jpg'] + ], + ['type' => 'words', + 'prompt' => 'Remember these target words', + 'targets' => ['tree', 'pine', 'root', 'glove', 'baseball', 'hotdog'] + ], + ['type' => 'stories', + 'prompt' => 'Remember these target stories', + 'targets' => ['The oldest surviving human, who was born in + 1902, recently identified her secret to long life, + citing the benefits of swimming every day in very + cold water.', + 'A poll, conducted a week ago by Pew Research, + found that 60% of people prefer vanilla icecream + to chocolate. Critics suggest that the poll + was biased.'], + ] + ], + 'choices' => [['color' => 'success', 'type' => 'images'], + ['color' => 'warning', 'type' => 'words'], + ['color' => 'danger', 'type' => 'stories']], + 'review_time' => 20], + + ['type' => 'text', + 'header' => 'Memory: practice round', + 'end_individual_section' => 'true', + 'text' => ['Now we will ask you some questions about the stimuli. + Remember, this is a practice!

+ You will answer as a group. When you’re answering the + questions everyone should be able to see the Reporter\'s + laptop.

+ If you are not the Reporter, leave your laptop open. You\'ll + come back to it shortly.

+ The practice questions will begin when The Reporter clicks "Next"' + ]], + + [ 'type' => 'practice_test_words', + 'selection_type' => 'select_all', + 'prompt' => 'Which of the following are target words?', + 'choices' => ['tree', 'pine', 'grow'], + 'correct' => [1, 2]], + + ['type' => 'practice_test_stories', + 'selection_type' => 'select_one', + 'prompt' => 'What year was the oldest known human born?', + 'choices' => ['1901', + '1902', + '1903'], + 'correct' => [2]], + + [ 'type' => 'practice_test_images', + 'selection_type' => 'select_one', + 'show_numbers' => 'false', + 'prompt' => 'Which of the following images is a "target" image?', + 'img' => '1_test_1.jpg', + 'correct' => [3]], + */ + ]// end blocks + ], // end group_2_instructions + + 'group_4_instructions' => [ + 'test_name' => 'group_3_instructions', + 'task_type' => 'mixed', + 'type' => 'intro', + 'directory' => '/img/memory-task/faces/', + 'wait_for_all'=>'true', 'blocks' => [ ['type' => 'text_intro', 'header' => 'Memory Task', @@ -1313,7 +1619,7 @@ class Memory { ]// end blocks ], // end group_2_instructions - + /* 'group_3_instructions' => [ 'test_name' => 'group_3_instructions', 'task_type' => 'mixed', @@ -1452,12 +1758,24 @@ class Memory { ]// end blocks ], // end group_3_instructions + */ + 'group_1' => [ 'test_name' => 'group_1', 'task_type' => 'mixed', 'type' => 'intro', 'directory' => '/img/memory-task/cars/', 'blocks' => [ + ['type'=>'text', + 'header'=>'', + 'wait_for_all'=>'true', + 'text' =>[ + 'When you click next, the group task will begin.', + 'Your group has 8 minutes to work through the task.', + 'Your time has already begun!', + 'Note: only the group Leader has information about the time remaining.', + 'Click Next to begin.' + ]], ['type'=>'text', 'header'=>'', @@ -1466,66 +1784,74 @@ class Memory { 'Now for the actual task', 'This will determine your score', 'Your group will have 40 seconds to memorize 6 images, 12 words and 2 short stories. This is like the practice, but you have twice as long to remember twice as much', - 'Click "Next" for some more information' + "Note: on average, groups require 5 minutes to complete the memorization phase and answer the questions.", + 'Click Next for some more information' ]], ['type'=>'text', 'header'=>'Final Instructions', 'wait_for_all'=>'true', - 'text' =>[ - 'Your group will have 40 seconds to memorize the words, images, and stories as a group', - "It may be helpful to reference your teammates' scores on the individual memory test to determine who should focus on each category", - " - - - - - - - - - - - - - - - - - - - - - - - - -
Participant ID - Images - - Words - - Stories -
- - - -
- - - -
- - - -
", - 'Click "Next" for some more information' - ]], + 'role' =>True, + 'leader' => ['As the LEADER you receive some extra information about scores on the individual memory test. Your teammates will not see this information.', + "Recall that you are responsible for answering questions in the task.", + " + + + + + + + + + + + + + + + + + + + + + + + + +
Role + Images + + Words + + Stories +
+ + + +
+ + + +
+ + + +
", + 'Click "Next" for some more information' + ], + 'follower1' => ['The leader is now viewing information that only they can see.', + 'The practice questions will begin when you all click next' + ], + 'follower2' => ['The leader is now viewing information that only they can see.', + 'The practice questions will begin when you all click next' + ] + ], ['type' => 'review_choice', 'header' => 'Memory Task', 'text' => ['This is the page where you can choose what to memorize.', 'If you want, you can try to memorize several types of stimuli.', 'Your 40 seconds starts when everyone in the group has made a choice.', - 'You’re NOT allowed to write anything down.'], + 'Please note: if anyone in your group writes anything down (or takes pictures of the stimuli) the whole group will not receive credit for the study.'], 'choices' => [['color' => 'success', 'type' => 'images'], ['color' => 'warning', 'type' => 'words'], ['color' => 'danger', 'type' => 'stories']], @@ -1568,7 +1894,7 @@ class Memory { 'wait_for_all' => 'true', 'role' => True, 'leader' => ['Now we will ask you some questions about the stimuli.', - 'You are the leader and are responsible for answering on behalf of the group.', + 'Remember: as the LEADER, only you can answer the questions (with the help of your team).', 'The questions will begin when you all click next' ], 'follower1' => ['Now we will ask you some questions about the stimuli.', @@ -1589,7 +1915,9 @@ class Memory { 'show_numbers' => 'false', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '1_test_1.jpg', - 'correct' => [3]], + 'correct' => [3], + 'num' => 1 + ], ['type' => 'test_stories', 'selection_type' => 'select_one', @@ -1598,26 +1926,30 @@ class Memory { 'choices' => ['Collisions with other shoppers', 'Running into stacks of groceries', 'Having accidents with their carts'], - 'correct' => [3]], + 'correct' => [3], + 'num' => 2], [ 'type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words?', 'choices' => ['fork', 'pan', 'knife'], - 'correct' => [1, 2]], + 'correct' => [1, 2], + 'num' => 3], [ 'type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'false', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '1_test_2.jpg', - 'correct' => [1]], + 'correct' => [1], + 'num' => 4], [ 'type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words?', 'choices' => ['spatula', 'beer', 'bomb'], - 'correct' => [1, 3]], + 'correct' => [1, 3], + 'num' => 5], ['type' => 'test_stories', 'selection_type' => 'select_one', @@ -1625,20 +1957,23 @@ class Memory { 'choices' => ['Recently', 'Last month', 'A week ago'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 6], [ 'type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'false', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '1_test_3.jpg', - 'correct' => [1]], + 'correct' => [1], + 'num' => 7], [ 'type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words?', 'choices' => ['whiskey', 'lemon', 'gun'], - 'correct' => []], + 'correct' => [], + 'num' => 8], ['type' => 'test_stories', 'selection_type' => 'select_one', @@ -1646,20 +1981,23 @@ class Memory { 'choices' => ['None', 'One', 'It\'s unclear based on the story'], - 'correct' => [3]], + 'correct' => [3], + 'num' => 9], [ 'type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words?', 'choices' => ['gun', 'pistol', 'trout'], - 'correct' => [2]], + 'correct' => [2], + 'num' => 10], [ 'type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'false', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '1_test_4.jpg', - 'correct' => [2]], + 'correct' => [2], + 'num' => 11], ['type' => 'test_stories', 'selection_type' => 'select_one', @@ -1667,7 +2005,8 @@ class Memory { 'choices' => ['They make an annoying noise', 'They have faulty wheels', 'They can be difficult to move'], - 'correct' => [2]], + 'correct' => [2], + 'num' => 12], ['type' => 'test_stories', 'selection_type' => 'select_one', @@ -1675,33 +2014,38 @@ class Memory { 'choices' => ['Grangers', 'Graysons', 'Greysons'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 13], [ 'type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'false', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '1_test_5.jpg', - 'correct' => [3]], + 'correct' => [3], + 'num' => 14], [ 'type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words?', 'choices' => ['wine', 'fork', 'sword'], - 'correct' => [1, 2, 3]], + 'correct' => [1, 2, 3], + 'num' => 15], [ 'type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'false', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '1_test_6.jpg', - 'correct' => [2]], + 'correct' => [2], + 'num' => 16], [ 'type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words?', 'choices' => ['rum', 'pencil', 'pot'], - 'correct' => [1, 3]], + 'correct' => [1, 3], + 'num' => 17], ['type' => 'test_stories', 'selection_type' => 'select_one', @@ -1709,14 +2053,16 @@ class Memory { 'choices' => ['Saying they will fix their shopping carts', 'Claiming the problem is with the customers', 'Promising they’ll look into the issue'], - 'correct' => [2]], + 'correct' => [2], + 'num' => 18], [ 'type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'false', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '1_test_7.jpg', - 'correct' => [2]], + 'correct' => [2], + 'num' => 19], ['type' => 'test_stories', 'selection_type' => 'select_one', @@ -1724,20 +2070,23 @@ class Memory { 'choices' => ['More than half', 'Almost all', '8 out of 10'], - 'correct' => [3]], + 'correct' => [3], + 'num' => 20], [ 'type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'false', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '1_test_8.jpg', - 'correct' => [3]], + 'correct' => [3], + 'num' => 21], [ 'type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words?', 'choices' => ['can', 'vodka', 'spoon'], - 'correct' => [1, 3]], + 'correct' => [1, 3], + 'num' => 22], ['type' => 'test_stories', 'selection_type' => 'select_one', @@ -1745,40 +2094,108 @@ class Memory { 'choices' => ['Black', 'Expensive', 'New'], - 'correct' => [2]], + 'correct' => [2], + 'num' => 23], [ 'type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words?', 'choices' => ['rifle', 'gold', 'strainer'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 24] ]// end blocks ], // end group_1 - 'group_2' => [ + 'group_2' => [ 'test_name' => 'group_2', 'task_type' => 'mixed', 'type' => 'intro', 'directory' => '/img/memory-task/faces/', 'blocks' => [ + ['type'=>'text', + 'header'=>'Memory Task', + 'wait_for_all'=>'true', + 'text' =>[ + 'The group task has now begun', + 'Your group has 8 minutes to work through the task.', + 'This time has already begun.', + 'Note: only the group Leader has information about the time remaining. There is a timer at the top of Leader\'s screen.', + 'Click Next to continue.' + ]], ['type' => 'text', - 'header' => 'Memory Task', + 'header' => '', 'wait_for_all' => 'true', - 'text' => ['You have seen this group memory task before, so we will NOT do a + 'text' => ['Many of you have seen this group memory task before, so we will NOT do a practice this time.', - 'Remember, each person will memorize the stimuli on their own computer. - But, you will answer as a group. Questions will only appear on - the Reporter\'s laptop.', + "Keep in mind: on average, groups require 5 minutes to complete the memorization phase and answer the questions.", 'The task will continue when everyone has clicked "Next".' ]], - ['type' => 'review_choice', - 'text' => ['You will have 40 seconds to memorize everything as a group. There - is a timer in the top right of the screen.', - 'Remember, during the 40 seconds, you can always change the stimuli - you are memorizing by clicking on a different button.', - 'You’re NOT allowed to write anything down.', - 'The time starts when everyone has clicked on one of the buttons.'], + ['type'=>'text', + 'header'=>'Final Instructions', + 'wait_for_all'=>'true', + 'role' =>True, + 'leader' => ['As the LEADER you receive some extra information about scores on the individual memory test. Your teammates will not see this information.', + "Recall that you are responsible for answering questions in the task.", + " + + + + + + + + + + + + + + + + + + + + + + + + +
Role + Images + + Words + + Stories +
+ + + +
+ + + +
+ + + +
", + 'Click "Next" for some more information' + ], + 'follower1' => ['The leader is now viewing information that only they can see.', + 'The practice questions will begin when you all click next' + ], + 'follower2' => ['The leader is now viewing information that only they can see.', + 'The practice questions will begin when you all click next' + ] + ], + ['type' => 'review_choice', + 'header' => 'Memory Task', + 'text' => ['This is the page where you can choose what to memorize.', + 'If you want, you can try to memorize several types of stimuli.', + 'Your 40 seconds starts when everyone in the group has made a choice.', + 'Please note: if anyone in your group writes anything down (or takes pictures of the stimuli) the whole group will not receive credit for the study.'], 'choices' => [['color' => 'success', 'type' => 'images'], ['color' => 'warning', 'type' => 'words'], ['color' => 'danger', 'type' => 'stories']], @@ -1814,27 +2231,34 @@ class Memory { ['color' => 'warning', 'type' => 'words'], ['color' => 'danger', 'type' => 'stories']], 'review_time' => 40], - - ['type' => 'text', - 'header' => '', - 'end_individual_section' => 'true', - 'text' => ['We will now ask you questions.', - 'Everyone should be able to see the screen of the Reporter\'s laptop. You will - answer as a group, on The Reporter\'s laptop.', - 'The questions will begin when The Reporter clicks "Next"' + ['type' => 'text', + 'header' => '', + 'wait_for_all' => 'true', + 'role' => True, + 'leader' => ['Now we will ask you some questions about the stimuli.', + 'Remember: as the LEADER, only you can answer the questions (with the help of your team).', + 'The questions will begin when you all click next' + ], + 'follower1' => ['Now we will ask you some questions about the stimuli.', + 'You will see the questions on your computer.', + "Your group leader will answer on the group's behalf", + 'The questions will begin when you all click next' + ], + 'follower2' => ['Now we will ask you some questions about the stimuli.', + 'You will see the questions on your computer.', + "Your group leader will answer on the group's behalf", + 'The questions will begin when you all click next' ]], - ['type' => 'text', - 'text' => ['Make sure all your group members - can see this screen. We are about to ask questions about - the words, stories and images you memorized.
- Click "Next" to continue.' - ]], - [ 'type' => 'test_images', + + + + [ 'type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" face?', 'img' => '2_test_1.jpg', - 'correct' => [3]], + 'correct' => [3], + 'num' => 1], [ 'type' => 'test_stories', 'selection_type' => 'select_one', @@ -1842,26 +2266,30 @@ class Memory { 'choices' => ['Europe and Mexico', 'Europe and China', 'China and Mexico'], - 'correct' => [2]], + 'correct' => [2], + 'num' => 2], ['type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['oil', 'kerosine', 'priest'], - 'correct' => [2]], + 'correct' => [2], + 'num' => 3], ['type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['salt', 'basement', 'piano'], - 'correct' => []], + 'correct' => [], + 'num' => 4], ['type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '2_test_2.jpg', - 'correct' => [1]], + 'correct' => [1], + 'num' => 5], [ 'type' => 'test_stories', 'selection_type' => 'select_one', @@ -1869,20 +2297,23 @@ class Memory { 'choices' => ['Stubborn', 'Cheap', 'Rude'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 6], ['type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '2_test_3.jpg', - 'correct' => [2]], + 'correct' => [2], + 'num' => 7], ['type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['wood', 'harmonica', 'trumpet'], - 'correct' => [1, 3]], + 'correct' => [1, 3], + 'num' => 8], [ 'type' => 'test_stories', 'selection_type' => 'select_one', @@ -1890,14 +2321,16 @@ class Memory { 'choices' => ['18 months ago', '6 months ago', '12 months ago'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 9], ['type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '2_test_4.jpg', - 'correct' => [3]], + 'correct' => [3], + 'num' => 10], ['type' => 'test_images', @@ -1905,7 +2338,8 @@ class Memory { 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '2_test_5.jpg', - 'correct' => [1]], + 'correct' => [1], + 'num' => 11], [ 'type' => 'test_stories', 'selection_type' => 'select_one', @@ -1913,7 +2347,8 @@ class Memory { 'choices' => ['Simpson', 'Sanderson', 'Sandford'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 12], [ 'type' => 'test_stories', 'selection_type' => 'select_one', @@ -1921,26 +2356,30 @@ class Memory { 'choices' => ['1933', '1932', '1923'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 13], ['type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['garlic', 'violin', 'vanilla'], - 'correct' => [1, 2, 3]], + 'correct' => [1, 2, 3], + 'num' => 14], ['type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '2_test_6.jpg', - 'correct' => [3]], + 'correct' => [3], + 'num' => 15], ['type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['chair', 'pepper', 'horn'], - 'correct' => []], + 'correct' => [], + 'num' => 16], [ 'type' => 'test_stories', 'selection_type' => 'select_one', @@ -1948,20 +2387,23 @@ class Memory { 'choices' => ['Ten thousand dollars', 'Eleven thousand dollars', 'Twelve thousand dollars'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 17], ['type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['sand', 'sugar', 'drum'], - 'correct' => [2]], + 'correct' => [2], + 'num' => 18], ['type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '2_test_7.jpg', - 'correct' => [2]], + 'correct' => [2], + 'num' => 19], [ 'type' => 'test_stories', 'selection_type' => 'select_one', @@ -1969,14 +2411,16 @@ class Memory { 'choices' => ['Slimmer waists and larger arms', 'Larger waists and slimmer legs', 'Slimmer waists and larger chests'], - 'correct' => [3]], + 'correct' => [3], + 'num' => 20], ['type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '2_test_8.jpg', - 'correct' => [2]], + 'correct' => [2], + 'num' => 21], [ 'type' => 'test_stories', 'selection_type' => 'select_one', @@ -1984,19 +2428,22 @@ class Memory { 'choices' => ['Relieved', 'Pleased', 'Grateful'], - 'correct' => [2]], + 'correct' => [2], + 'num' => 22], ['type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['flute', 'clarinet', 'piano'], - 'correct' => [2]], + 'correct' => [2], + 'num' => 23], ['type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['coal', 'electricity', 'lemon'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 24], ]// end blocks ], // end group_2 @@ -2007,26 +2454,89 @@ class Memory { 'type' => 'intro', 'directory' => '/img/memory-task/bikes/', 'blocks' => [ + ['type'=>'text', + 'header'=>'Memory Task', + 'wait_for_all'=>'true', + 'text' =>[ + 'The group task has now begun', + 'Your group has 8 minutes to work through the task.', + 'This time has already begun.', + 'Note: only the group Leader has information about the time remaining. There is a timer at the top of Leader\'s screen.', + 'Click Next to continue.' + ]], ['type' => 'text', - 'header' => 'Memory Task', + 'header' => '', 'wait_for_all' => 'true', - 'text' => ['Your group will have 40 seconds to memorize 6 images, 12 words and 2 short - stories.', - 'Everyone should be in front of their own laptop. During the memorization - period, you have the option of looking at multiple types of stimuli - (e.g. stories AND - images). Or, - you can divide the responsibilities of memorizing different things.', - 'Take some time to discuss how you will approach this task.', - 'You will receive some final instructions when each group member has clicked "Next".' + 'text' => ['Many of you have seen this group memory task before, so we will NOT do a + practice this time.', + "Keep in mind: on average, groups require 5 minutes to complete the memorization phase and answer the questions. ", + 'The task will continue when everyone has clicked "Next".' ]], - ['type' => 'review_choice', - 'text' => ['Remember: you have 40 seconds, and there is a timer in - the top right of the screen.', - 'You’re NOT allowed to write anything down.', - 'If you want, you can always change the stimuli - you are memorizing by clicking on a different button..', - 'The timer starts when everyone has clicked on one of the buttons.'], + ['type'=>'text', + 'header'=>'Final Instructions', + 'wait_for_all'=>'true', + 'role' =>True, + 'leader' => ['As the LEADER you receive some extra information about scores on the individual memory test. Your teammates will not see this information.', + "Recall that you are responsible for answering questions in the task.", + " + + + + + + + + + + + + + + + + + + + + + + + + +
Role + Images + + Words + + Stories +
+ + + +
+ + + +
+ + + +
", + 'Click "Next" for some more information' + ], + 'follower1' => ['The leader is now viewing information that only they can see.', + 'The practice questions will begin when you all click next' + ], + 'follower2' => ['The leader is now viewing information that only they can see.', + 'The practice questions will begin when you all click next' + ] + ], + ['type' => 'review_choice', + 'header' => 'Memory Task', + 'text' => ['This is the page where you can choose what to memorize.', + 'If you want, you can try to memorize several types of stimuli.', + 'Your 40 seconds starts when everyone in the group has made a choice.', + 'Please note: if anyone in your group writes anything down (or takes pictures of the stimuli) the whole group will not receive credit for the study.'], 'choices' => [['color' => 'success', 'type' => 'images'], ['color' => 'warning', 'type' => 'words'], ['color' => 'danger', 'type' => 'stories']], @@ -2063,22 +2573,34 @@ class Memory { ['color' => 'warning', 'type' => 'words'], ['color' => 'danger', 'type' => 'stories']], 'review_time' => 40], - - ['type' => 'text', - 'header' => '', - 'end_individual_section' => 'true', - 'text' => ['We will now ask you questions.', - 'Everyone should be able to see the screen of the Reporter\'s laptop. You will - answer as a group, on The Reporter\'s laptop.', - 'The questions will begin when The Reporter clicks "Next"' + ['type' => 'text', + 'header' => '', + 'wait_for_all' => 'true', + 'role' => True, + 'leader' => ['Now we will ask you some questions about the stimuli.', + 'Remember: as the LEADER, only you can answer the questions (with the help of your team).', + 'The questions will begin when you all click next' + ], + 'follower1' => ['Now we will ask you some questions about the stimuli.', + 'You will see the questions on your computer.', + "Your group leader will answer on the group's behalf", + 'The questions will begin when you all click next' + ], + 'follower2' => ['Now we will ask you some questions about the stimuli.', + 'You will see the questions on your computer.', + "Your group leader will answer on the group's behalf", + 'The questions will begin when you all click next' ]], + - [ 'type' => 'test_images', + + [ 'type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '1_test_1.jpeg', - 'correct' => [1]], + 'correct' => [1], + 'num' => 1], [ 'type' => 'test_stories', 'selection_type' => 'select_one', @@ -2086,20 +2608,23 @@ class Memory { 'choices' => ['San Jose', 'San Diego', 'San Francisco'], - 'correct' => [3]], + 'correct' => [3], + 'num' => 2], ['type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '1_test_2.jpeg', - 'correct' => [2]], + 'correct' => [2], + 'num' => 3], ['type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['child', 'bluebird', 'chapel'], - 'correct' => [2]], + 'correct' => [2], + 'num' => 4], [ 'type' => 'test_stories', 'selection_type' => 'select_one', @@ -2107,32 +2632,37 @@ class Memory { 'choices' => ['Monday', 'Sunday', 'Tuesday'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 5], ['type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '1_test_3.jpeg', - 'correct' => [1]], + 'correct' => [1], + 'num' => 6], ['type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['canary', 'socks', 'robin'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 7], ['type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['hammer', 'skirt', 'apple'], - 'correct' => [2]], + 'correct' => [2], + 'num' => 8], ['type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '1_test_4.jpeg', - 'correct' => [2]], + 'correct' => [2], + 'num' => 9], [ 'type' => 'test_stories', 'selection_type' => 'select_one', @@ -2140,13 +2670,15 @@ class Memory { 'choices' => ['$220,000', '$200,000', '$20,000'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 10], ['type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['shirt', 'saw', 'wren'], - 'correct' => []], + 'correct' => [], + 'num' => 11], [ 'type' => 'test_stories', 'selection_type' => 'select_one', @@ -2154,20 +2686,23 @@ class Memory { 'choices' => ['At least 4 inches', 'Up to 4 inches', 'More than 4 inches'], - 'correct' => [2]], + 'correct' => [2], + 'num' => 12], ['type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['chisel', 'screwdriver', 'sparrow'], - 'correct' => [1, 2]], + 'correct' => [1, 2], + 'num' => 13], ['type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '1_test_5.jpeg', - 'correct' => [3]], + 'correct' => [3], + 'num' => 14], [ 'type' => 'test_stories', 'selection_type' => 'select_one', @@ -2175,20 +2710,23 @@ class Memory { 'choices' => ['36', '46', '26'], - 'correct' => [2]], + 'correct' => [2], + 'num' => 15], ['type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '1_test_6.jpeg', - 'correct' => [3]], + 'correct' => [3], + 'num' => 16], ['type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['silver', 'nails', 'eagle'], - 'correct' => [2, 3]], + 'correct' => [2, 3], + 'num' => 17], [ 'type' => 'test_stories', 'selection_type' => 'select_one', @@ -2196,20 +2734,23 @@ class Memory { 'choices' => ['Her manager', 'Her employer', 'Her customer'], - 'correct' => [3]], + 'correct' => [3], + 'num' => 18], ['type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '1_test_7.jpeg', - 'correct' => [2]], + 'correct' => [2], + 'num' => 19], ['type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['crow', 'rock', 'rook'], - 'correct' => [1]], + 'correct' => [1], + 'num' => 20], [ 'type' => 'test_stories', 'selection_type' => 'select_one', @@ -2217,14 +2758,16 @@ class Memory { 'choices' => ['Call in sick', 'Watch old movies', 'Go back to watching TV programs'], - 'correct' => [2]], + 'correct' => [2], + 'num' => 21], ['type' => 'test_images', 'selection_type' => 'select_one', 'show_numbers' => 'true', 'prompt' => 'Which of the following images is a "target" image?', 'img' => '1_test_8.jpeg', - 'correct' => [3]], + 'correct' => [3], + 'num' => 22], [ 'type' => 'test_stories', 'selection_type' => 'select_one', @@ -2232,15 +2775,17 @@ class Memory { 'choices' => ['He was watching a news program', 'A weather report interrupted the program he was watching', 'He saw a weather bulletin between shows'], - 'correct' => [2]], + 'correct' => [2], + 'num' => 23], ['type' => 'test_words', 'selection_type' => 'select_all', 'prompt' => 'Which of the following are target words', 'choices' => ['blouse', 'pants', 'wrench'], - 'correct' => [1, 2, 3]], + 'correct' => [1, 2, 3], + 'num' => 24] ]// end blocks - ], // end group_3 + ], // end group_2 'group_4' => [ 'test_name' => 'group_4', diff --git a/database/migrations/2022_04_26_101501_add_role_to_responses.php b/database/migrations/2022_04_26_101501_add_role_to_responses.php new file mode 100644 index 00000000..41d173f1 --- /dev/null +++ b/database/migrations/2022_04_26_101501_add_role_to_responses.php @@ -0,0 +1,32 @@ +string('role')->default(''); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('responses', function (Blueprint $table) { + $table->dropColumn('role'); + }); + } +} diff --git a/public/css/room-test.css b/public/css/room-test.css new file mode 100644 index 00000000..9a750b83 --- /dev/null +++ b/public/css/room-test.css @@ -0,0 +1,8266 @@ + @stop @section('js') + @stop @@ -46,6 +71,12 @@ @section('content')
+ @if($type == 'adblock') +
+
+
+
+ @endif
@foreach($introContent as $content) diff --git a/resources/views/layouts/participants/task-room-new.blade.php b/resources/views/layouts/participants/task-room-new.blade.php new file mode 100644 index 00000000..6a31ee79 --- /dev/null +++ b/resources/views/layouts/participants/task-room-new.blade.php @@ -0,0 +1,204 @@ +@extends('layouts.master') + +@section('title','Group Cryptography') + +@section('js') + + + + + +@stop + +@section('css') + + +@stop + +@section('content') + + +
+ @if($user->group_role == 'leader') +
+

{{ $time_label }}: {{ gmdate('i:s',$time_remaining) }}

+
+ @endif +
+
+ +
+
+

Your role: + @if($user->group_role == 'follower1') + @if($task->Name == "Cryptography") + Equations + @else + Team Member 1 + @endif + @elseif($user->group_role == 'follower2') + @if($task->Name == "Cryptography") + Hypotheses + @else + Team Member 2 + @endif + @else + Leader + @endif +

+
+
+ +
+
+
+
+
+
+
+
+ + +@stop diff --git a/resources/views/layouts/participants/task-room.blade.php b/resources/views/layouts/participants/task-room.blade.php index e9804bea..a67d119e 100644 --- a/resources/views/layouts/participants/task-room.blade.php +++ b/resources/views/layouts/participants/task-room.blade.php @@ -4,8 +4,8 @@ @section('js') - - + + @stop @@ -19,7 +19,6 @@ //VARIABLES NEEDED FOR VIDEO CONFERENCING AND CLOUD STORAGE var resourceId = ''; var sid = ''; - var rtc = { client: null, joined: false, @@ -28,7 +27,6 @@ remoteStreams: [], params: {} }; - var resolutions = [ { name: "default", @@ -47,21 +45,15 @@ value: "1080p" } ]; - //GET TIME TIL SUBSESSION ENDS, FOR LEADER var task_time_remaining = parseInt('{{ $time_remaining }}'); - - $( document ).ready(function() { //SET TIMER FOR LEADER var subsession_itv = setInterval(function(){ - task_time_remaining -= 1; - $('#task_time_remaining').text(task_time_remaining > 0 ? new Date(task_time_remaining * 1000).toISOString().substr(14, 5) : '00:00'); },1000); - //ENDS CLOUD RECORDING WHEN LEADER LEAVES PAGE //PROBABLY UNECESSARY OR AT LEAST SHOULD BE SET TO HAPPEN AT SUBSESSION END /* @@ -78,10 +70,17 @@ }); }); */ - + group_role = "{{ $user->group_role }}"; + uid = ""; + if(group_role == 'leader') + uid = "1"; + else if(group_role == 'follower1') + uid = "2"; + else + uid = "3"; //PINGS CUSTOM TOKEN-GENERATOR HEROKU APP FOR ACCESS TO WEB CONFERENCE, //APP COMMUNICATES WITH AGORA API - jQuery.get( "https://teamwork-token-gen.herokuapp.com/access_token?channel=group{{ $user->group_id }}&uid={{ $user->id }}", function( data ) { + jQuery.get( "https://teamwork-token-gen.herokuapp.com/access_token?channel=group{{ $user->group_id }}&uid="+uid, function( data ) { //TOKEN REQUIRED FOR ACCESS token = data.token; @@ -93,7 +92,7 @@ //CHANNEL NAME IS WHAT LINKS USERS INTO THE SAME VIDEO CALL channel: "group{{ $user->group_id }}", //UID MUST BE AN INTEGER, CURRENTLY SET TO UNIQUE USER_ID - uid:"{{ $user->id }}", + uid:uid, token:token, }; @@ -108,14 +107,11 @@ params.cameraResolution = "default"; }); }); - //ATTEMPTS TO JOIN VIDEO CALL join(rtc,params); - //IF USER IS LEADER, SEND AJAX CALL TO CUSTOM API ROUTER APP TO START CLOUD RECORDING //OUTER AJAX CALLS TO CHECK IF RECORDING AVAILABLE, INNER AJAX STARTS RECORDING if('{{ $user->group_role }}' === 'leader'){ - $.ajax({ type: "POST", url: "https://teamwork-agora-api-caller.herokuapp.com/acquire", @@ -126,7 +122,6 @@ success: function(data){ //STARTS RECORDING resourceId = data['resourceId']; - jQuery.ajax({ type:"POST", url:"https://teamwork-agora-api-caller.herokuapp.com/start", @@ -140,29 +135,23 @@ }, contentType: "application/json; charset=UTF-8" }); - }, contentType: "application/json; charset=UTF-8" }); - } }); - //RENDERS THE TASK AT HAND IN THE 'CONTENT' CONTAINER, WITH WEB CONFERENCE OVERLA jQuery.get('/get-group-task', function(data){ $('#content').html(data); }); }); - - -
@if($user->group_role == 'leader')
-
{{ $time_label }}: {{ gmdate('i:s',$time_remaining) }}
+

{{ $time_label }}: {{ gmdate('i:s',$time_remaining) }}

@endif
@@ -170,17 +159,24 @@
-

Your Team:

-
-
Your role: +

Your role: @if($user->group_role == 'follower1') + @if($task->Name == "Cryptography") Equations + @else + Team Member 1 + @endif @elseif($user->group_role == 'follower2') + @if($task->Name == "Cryptography") Hypotheses + @else + Team Member 2 + @endif @else Leader @endif -

+ +
@@ -190,4 +186,4 @@
-@stop +@stop \ No newline at end of file diff --git a/resources/views/layouts/participants/tasks/big-five.blade.php b/resources/views/layouts/participants/tasks/big-five.blade.php index 16ede2d5..4e0d02da 100644 --- a/resources/views/layouts/participants/tasks/big-five.blade.php +++ b/resources/views/layouts/participants/tasks/big-five.blade.php @@ -48,6 +48,7 @@
+
In relation to other people of the same gender who are roughly my age, I would say that I:
{{ csrf_field() }} diff --git a/resources/views/layouts/participants/tasks/cryptography-group-intro.blade.php b/resources/views/layouts/participants/tasks/cryptography-group-intro.blade.php index 664b7bde..81ea64f9 100644 --- a/resources/views/layouts/participants/tasks/cryptography-group-intro.blade.php +++ b/resources/views/layouts/participants/tasks/cryptography-group-intro.blade.php @@ -16,6 +16,8 @@ var page_count; var tmt; var status = '{{ $user->status }}'; +var introType = '{{ $introType }}'; +var role = '{{ $user->group_role }}'; $( document ).ready(function() { //$('#time_label').text('Time Until Task Begins'); @@ -70,7 +72,7 @@ //IF SUBSESSION ENDS, END TASK channel.bind('end-subsession', function(data){ - if(data['user']['id'] == user_id && data['order'] == 2){ + if(data['user']['id'] == user_id && data['order'] == 1){ window.location.href='/end-intro'; } }); @@ -104,6 +106,39 @@ window.location.href='/participant-login'; }); + channel.bind('role-changed', function(data){ + if(role != data['user']['group_role'] && role != 'leader'){ + if(data['user']['group_role'] == 'follower1' && data['user']['id'] == user_id){ + $('#inst_3').html(`

Instructions

+
+ You have been assigned the role of entering equations. +
+
+ An 'equation' is a combination of letters with + and - (you can't multiply or divide). For example, you might enter A + B. +
+
+ Entering an equation is the first step in each 'round'. Each round has three steps. +
`); + $('#role_switcher').text('equations'); + } + if(data['user']['group_role'] == 'follower2' && data['user']['id'] == user_id){ + $('#inst_3').html(`

Instructions

+
+ You have been assigned the role of making hypotheses. +
+
+ This is the part of each 'round' where you can get feedback from the computer about one letter. For example, you might hypothesize that C = 3, and the computer would tell you whether your guess is correct. +
+
+ This is the second step in each 'round'. Each round has three steps. +
`); + $('#role_switcher').text('hypotheses'); + + } + + } + }); + //IF ALL USERS IN GROUP HAVE PRESSED NEXT channel.bind('all-ready', function(data) { @@ -124,8 +159,12 @@ $("#inst_" + page_count).hide(); page_count += 1; + localStorage.setItem('pageCount',page_count); + if(page_count == 2 && introType == 'not_first' && role == 'leader') + $('#next').hide(); + //IF END OF INSTRUCTIONS, PROCEED if(page_count >= $(".inst").length){ $('#next').hide(); @@ -165,6 +204,135 @@ }); + $('#role_1').on('change',function(){ + if($(this).val() == '1'){ + $.ajax({ + type: "POST", + url: '/assign-role', + data:{user:'{{ $follower1->id }}',role:'follower1',_token: "{{ csrf_token() }}",}, + success: function(data){ + console.log('set!'); + } + }); + $.ajax({ + type: "POST", + url: '/assign-role', + data:{user:'{{ $follower2->id }}',role:'follower2',_token: "{{ csrf_token() }}",}, + success: function(data){ + console.log('set!'); + } + }); + $('#role_2').val('2'); + $('#next').show(); + } + else if($(this).val() == '2'){ + $.ajax({ + type: "POST", + url: '/assign-role', + data:{user:'{{ $follower1->id }}',role:'follower2',_token: "{{ csrf_token() }}",}, + success: function(data){ + console.log('set!'); + } + }); + $.ajax({ + type: "POST", + url: '/assign-role', + data:{user:'{{ $follower2->id }}',role:'follower1',_token: "{{ csrf_token() }}",}, + success: function(data){ + console.log('set!'); + } + }); + $('#role_2').val('1'); + $('#next').show(); + } + else{ + $.ajax({ + type: "POST", + url: '/assign-role', + data:{user:'{{ $follower1->id }}',role:'follower1',_token: "{{ csrf_token() }}",}, + success: function(data){ + console.log('set!'); + } + }); + $.ajax({ + type: "POST", + url: '/assign-role', + data:{user:'{{ $follower2->id }}',role:'follower2',_token: "{{ csrf_token() }}",}, + success: function(data){ + console.log('set!'); + } + }); + $('#role_2').val('---'); + $('#role_1').val('---'); + $('#next').hide(); + } + }); + $('#role_2').on('change',function(){ + if($(this).val() == '1'){ + $.ajax({ + type: "POST", + url: '/assign-role', + data:{user:'{{ $follower1->id }}',role:'follower2',_token: "{{ csrf_token() }}",}, + success: function(data){ + console.log('set!'); + } + }); + $.ajax({ + type: "POST", + url: '/assign-role', + data:{user:'{{ $follower2->id }}',role:'follower1',_token: "{{ csrf_token() }}",}, + success: function(data){ + console.log('set!'); + } + }); + $('#role_1').val('2'); + $('#next').show(); + } + else if($(this).val() == '2'){ + $.ajax({ + type: "POST", + url: '/assign-role', + data:{user:'{{ $follower1->id }}',role:'follower2',_token: "{{ csrf_token() }}",}, + success: function(data){ + console.log('set!'); + } + }); + $.ajax({ + type: "POST", + url: '/assign-role', + data:{user:'{{ $follower2->id }}',role:'follower1',_token: "{{ csrf_token() }}",}, + success: function(data){ + console.log('set!'); + } + }); + $('#role_1').val('1'); + $('#next').show(); + + } + else{ + $.ajax({ + type: "POST", + url: '/assign-role', + data:{user:'{{ $follower1->id }}',role:'follower1',_token: "{{ csrf_token() }}",}, + success: function(data){ + console.log('set!'); + } + }); + $.ajax({ + type: "POST", + url: '/assign-role', + data:{user:'{{ $follower2->id }}',role:'follower2',_token: "{{ csrf_token() }}",}, + success: function(data){ + console.log('set!'); + } + }); + $('#role_1').val('---'); + $('#role_2').val('---'); + $('#next').hide(); + + } + }); + //INITIALIZE PAGINATOR instructionPaginator(function(){window.location = '/cryptography';}); @@ -189,15 +357,15 @@ @if($introType == 'group_1' || $introType == 'group_2')
-

Welcome to your new group

+

Welcome to your first group

- You will be working together for 10-12 minutes, trying to solve the GROUP CRYPTOGRAPHY puzzle. + You will be working together for about {{ intdiv($task_length + $intro_length,60) }} minutes, trying to solve the GROUP CRYPTOGRAPHY puzzle.
Please take a moment to introduce yourselves.
- Note that you have 3 minutes to learn about the group task before it begins! (There is a timer at the top of the screen). + Note that you have {{ intdiv($intro_length,60) }} minutes to learn about the group task before it begins! (The group leader has information about time remaining.)
@@ -219,9 +387,9 @@
You do this through completing 'rounds'. A round has three steps:
- 1. Enter an equation (e.g. CC + B - A = ?)
- 2. Make a hypothesis (e.g. C = 1)
- 3. Guess the letter values + 1. Enter an equation (e.g. CC + B - A = ?)
+ 2. Make a hypothesis (e.g. C = 1)
+ 3. Guess the letter values
Your goal is to solve the puzzle using the SMALLEST number of rounds. This is how you get a good score. @@ -231,61 +399,107 @@

Instructions

@if ($user->group_role == "leader")
- You are the group's leader + You are the group's leader. You have three main responsibilities. Only you can: +
+
    +
  • +
    + Guess the final letter values for each letter (e.g., A=4, B=2). This is the last step in each 'round'. Each round has 3 steps. +
    +
  • +
  • +
    + Make sure that the group follows the 'equation rules'. There is more information about rules on the next page. +
    +
  • +
  • +
    + Manage time. Nobody else in your group has information about the time remaining. +
    +
  • +
+ + @elseif ($user->group_role == "follower1") +
+ You have been assigned the role of entering equations. +
+
+ An 'equation' is a combination of letters with + and - (you can't multiply or divide). For example, you might enter A + B. +
+
+ Entering an equation is the first step in each 'round'. Each round has three steps. +
+ @elseif($user->group_role == 'follower2') +
+ You have been assigned the role of making hypotheses. +
+
+ This is the part of each 'round' where you can get feedback from the computer about one letter. For example, you might hypothesize that C = 3, and the computer would tell you whether your guess is correct. +
+
+ This is the second step in each 'round'. Each round has three steps. +
+ @endif +
+
+ + @if ($user->group_role == "leader") +

Rules

- You are responsible for guessing the final letter values for each letter (e.g. A=4, B=2) + There are rules about the equations your group can enter. You have already seen similar rules in the individual cryptography task.
- This is the last step in each 'round'. + Only the leader can see the rules.
- You are also responsible for making sure that the group follows the "equation rules".
+ If the group breaks a rule, the leader receives a lower score (and payment). There is more information about compensation on the next page.
- @endif - @if ($user->group_role == "follower1") + @elseif ($user->group_role == "follower1") +

Final Reminders

- You have been assigned the role of entering equations. + Feel free to discuss your equations with your group before entering them.
- An 'equation' is a combination of letters with + and - (you can't multiply or divide). For example, you might enter A + B. + The group’s goal is to solve the puzzle in as few rounds as possible.
- Entering an equation is the first step in each 'round'. + Your group leader has a timer, which shows when the puzzle will begin.
- Feel free to discuss your equation with your group before entering it. + Good luck!
- @endif - @if($user->group_role == 'follower2') -
- You have been assigned the role of making hypotheses + @elseif ($user->group_role == "follower2") +

Final Reminders

+
+ Feel free to discuss your hypotheses with your group before entering them.
- This is the part of each 'round' where you can get feedback from the computer about one letter. For example, you might hypothesize that C = 3, and the computer would tell you whether your guess is correct. + The group’s goal is to solve the puzzle in as few rounds as possible.
- This is the second step in each 'round'. + Your group leader has a timer, which shows when the puzzle will begin.
- Feel free to discuss your hypothesis with your group before entering it. + Good luck!
@endif -
-
-

Instructions

+
+
+ @if ($user->group_role == "leader") +

Compensation

- As the Leader, you are responsible for the team. In particular, you are responsible for time management. + As the leader, you are compensated based on group performance. Your teammates are only compensated for their time.
- Your teammates are only compensated for their time.
You are compensated based on group performance. + To get a good score, you must solve the puzzle in as few rounds as possible AND not break any rules!
- If your group solves the puzzle, you will receive a payment of $7.00. Each 'round' costs you $0.50. Breaking a rule costs $2.00. You will get partial payment for partially solving the puzzle. + You start with a ‘completion bonus’ of $9. Each ‘round’ lowers the bonus by 50 cents. Breaking a rule costs $3.00.
- Whether you share information about how you are compensated as leader is up to you. + You will receive partial payment for partially solving the puzzle.
@else
@@ -293,8 +507,7 @@
@endif
-
-

Instructions

+
The task will begin shortly. Please feel free to use this time to talk to your teammates, or strategize about the task.
@@ -302,6 +515,165 @@

+
+@elseif($introType == "not_first") +
+

Welcome to your new group

+
+ You have {{ intdiv($intro_length,60) }} minutes before the puzzle begins. Please introduce yourselves! +
+
+ In this new group, the Leader will assign each team member to a role: entering equations and making hypotheses. +
+
+ When you are ready, click next and the Leader will assign these roles. Then, you will be able to review the instructions for your assigned role. +
+
+
+

Role Assignment

+ @if ($user->group_role == "leader") +
+ Leader: please assign Team Member 1 and Team Member 2 to a role. +
+
+
+
Entering equations
+
+ +
+
+
Entering hypotheses
+
+ +
+ +
+ @else +
+ Your leader is now assigning you a role. Once you have a role, you can click next to review the instructions for your role. +
+ @endif +
+
+

Instructions

+ @if ($user->group_role == "leader") +
+ You are the group's leader. You have three main responsibilities. Only you can: +
+
    +
  • +
    + Guess the final letter values for each letter (e.g., A=4, B=2). This is the last step in each 'round'. Each round has 3 steps. +
    +
  • +
  • +
    + Make sure that the group follows the 'equation rules'. There is more information about rules on the next page. +
    +
  • +
  • +
    + Manage time. Nobody else in your group has information about the time remaining. +
    +
  • +
+ + + @endif + @if ($user->group_role == "follower1") +
+ You have been assigned the role of entering equations. +
+
+ An 'equation' is a combination of letters with + and - (you can't multiply or divide). For example, you might enter A + B. +
+
+ Entering an equation is the first step in each 'round'. Each round has three steps. +
+ @endif + @if($user->group_role == 'follower2') +
+ You have been assigned the role of making hypotheses. +
+
+ This is the part of each 'round' where you can get feedback from the computer about one letter. For example, you might hypothesize that C = 3, and the computer would tell you whether your guess is correct. +
+
+ This is the second step in each 'round'. Each round has three steps. +
+ @endif +
+
+ + @if ($user->group_role == "leader") +

Compensation

+
+ As the leader, you are compensated based on group performance. Your teammates are only compensated for their time. +
+
+ To get a good score, you must solve the puzzle in as few rounds as possible AND not break any rules! +
+
+ You start with a ‘completion bonus’ of $9. Each ‘round’ lowers the bonus by 50 cents. Breaking a rule costs $3.00. +
+
+ You will receive partial payment for partially solving the puzzle. +
+ @endif + @if ($user->group_role == "follower1") +

Final Reminders

+
+ Feel free to discuss your equations with your group before entering them. +
+
+ The group’s goal is to solve the puzzle in as few rounds as possible. +
+
+ Your group leader has a timer, which shows when the puzzle will begin. +
+
+ Good luck! +
+ @endif + @if ($user->group_role == "follower2") +
+ Feel free to discuss your hypotheses with your group before entering them. +
+
+ The group’s goal is to solve the puzzle in as few rounds as possible. +
+
+ Your group leader has a timer, which shows when the puzzle will begin. +
+
+ Good luck! +
+ @endif +
+
+
+ The task will begin shortly. Please feel free to use this time to talk to your teammates, or strategize about the task. +
+
+
+
+
@endif diff --git a/resources/views/layouts/participants/tasks/cryptography-group.blade.php b/resources/views/layouts/participants/tasks/cryptography-group.blade.php index 1e2393dc..32aabf69 100644 --- a/resources/views/layouts/participants/tasks/cryptography-group.blade.php +++ b/resources/views/layouts/participants/tasks/cryptography-group.blade.php @@ -1,7 +1,7 @@ @extends('layouts.bare') @section('js') - + @stop @@ -30,7 +30,7 @@ var equations = []; var hypotheses = []; var mapping_guess = ''; -var payment = 5.00; +var payment = 9.00; var guesses = []; var page = 1; var tm; @@ -87,11 +87,12 @@ function clear_timer(){ } //IF RULE BROKEN RESPONSE if(responses[i]['prompt'].includes('Rule Broken')){ - payment -= 2.00; + payment -= 3.00; } + } //UPDATE PAYMENT AND TRIAL COUNTER - $('#payment').text(payment.toFixed(2)); + $('#payment').text(payment > 0 ? payment.toFixed(2) : "0.00"); $("#trial-counter").html(trials); } @@ -142,52 +143,129 @@ function clear_timer(){ //RULESETS rules = { - 1:[1,4], - 2:[1,7], - 3:[1,8], - 4:[1,9], - 5:[2,10], - 6:[2,11], - 7:[2,12], - 8:[2,15], - 9:[3,4], - 10:[3,5], - 11:[3,6], - 12:[3,7], - 13:[4,8], - 14:[5,9], - 15:[6,10], - 16:[7,11] + 1:[1,2], + 2:[3,1,2], + 3:[20,11,41,85,2,1], + 4:[1,61,5,2,36,89], + 5:[37,2,1,63,13,75], + 6:[69,9,22,38,1,2], + 7:[60,2,39,1,16,29], + 8:[2,87,64,11,48,1], + 9:[72,35,4,2,1,82], + 10:[49,65,1,2,24,6], + 11:[2,1,44,25,8,66], + 12:[58,32,1,62,7,2], + 13:[23,2,59,45,1,88], + 14:[1,11,67,2,21,47] }; - rule_desc = [ - 'The first equation must not contain more than 4 letters', - 'The first equation must contain at least 3 letters', - 'The first equation must contain a minus sign', - 'The second equation must contain the letter F', - 'The second equation must contain the letter G', - 'The second equation must contain the letter H', - 'The second equation must contain the letter I', - 'The third equation must NOT contain the letter A', - 'The third equation must NOT contain the letter B', - 'The third equation must NOT contain the letter C', - 'The third equation must NOT contain the letter D', - 'The fourth equation must contain a minus sign', - 'The fourth equation must NOT contain a minus sign', - 'The fifth equation must contain a minus sign', - 'The fifth equation must NOT contain a minus sign', - ] + rule_desc =[ + 'An equation cannot use all 10 letters', + 'Equations must use at least 2 different letters', + 'The 2nd and 5th equations must contain a minus sign', + 'The 3rd and 4th equations must contain a minus sign', + 'The 4th and 7th equations must contain a minus sign', + 'The 3rd and 7th equations must contain a minus sign', + 'The 2nd and 8th equations must contain a minus sigh', + 'The 3rd and 9th equations must contain a minus sign', + 'The 4th and 5th equations must NOT contain a minus sign', + 'The 3rd and 5th equations must NOT contain a minus sign', + 'The 3rd, 5th, and 7th equations must contain an odd number of letters', + 'The 3rd and 6th equations must contain 3 letters', + 'The 2nd and 4th equations must contain 3 letters', + 'The 2nd and 6th equations must contain 3 letters', + 'The 5th and 7th equations must contain 3 letters', + 'The 4th and 8th equations must contain 3 letters', + 'The 1st equation must contain a minus sign', + '', + '', + 'The 2nd equation must contain a minus sign', + 'The 2nd equation must NOT contain a minus sign', + 'The 2nd equation must contain the letter F', + 'The 2nd equation must contain the letter G', + 'The 2nd equation must contain the letter H', + 'The 2nd equation must contain the letter I', + 'The 2nd equation must NOT contain the letter A', + 'The 2nd equation must NOT contain the letter J', + 'The 2nd equation must NOT contain the letter E', + 'The 2nd equation must NOT contain the letter B', + 'The 3rd equation must contain a minus sign', + 'The 3rd equation must NOT contain the letter F', + 'The 3rd equation must NOT contain the letter G', + 'The 3rd equation must NOT contain the letter H', + 'The 3rd equation must NOT contain the letter I', + 'The 3rd equation must contain the letter C', + 'The 3rd equation must contain the letter J', + 'The 3rd equation must contain the letter E', + 'The 3rd equation must contain the letter B', + 'The 3rd equation must contain the letter A', + 'The 4th equation must contain a minus sign', + 'The 4th equation must NOT contain the letter F', + 'The 4th equation must NOT contain the letter G', + 'The 4th equation must NOT contain the letter H', + 'The 4th equation must NOT contain the letter I', + 'The 4th equation must contain the letter C', + 'The 4th equation must contain the letter J', + 'The 4th equation must contain the letter E', + 'The 4th equation must contain the letter B', + 'The 4th equation must contain the letter A', + 'The 5th equation must contain a minus sign', + 'The 5th equation must NOT contain the letter A', + 'The 5th equation must NOT contain the letter J', + 'The 5th equation must NOT contain the letter E', + 'The 5th equation must NOT contain the letter I', + 'The 5th equation must contain the letter C', + 'The 5th equation must contain the letter H', + 'The 5th equation must contain the letter F', + 'The 5th equation must contain the letter D', + 'The 5th equation must contain the letter B', + 'The 6th equation must contain a minus sign', + 'The 6th equation must NOT contain the letter F', + 'The 6th equation must NOT contain the letter G', + 'The 6th equation must NOT contain the letter H', + 'The 6th equation must NOT contain the letter I', + 'The 6th equation must contain the letter C', + 'The 6th equation must contain the letter J', + 'The 6th equation must contain the letter E', + 'The 6th equation must contain the letter B', + 'The 6th equation must contain the letter A', + 'The 7th equation must contain a minus sign', + 'The 7th equation must NOT contain the letter A', + 'The 7th equation must NOT contain the letter J', + 'The 7th equation must NOT contain the letter E', + 'The 7th equation must NOT contain the letter I', + 'The 7th equation must contain the letter C', + 'The 7th equation must contain the letter H', + 'The 7th equation must contain the letter F', + 'The 7th equation must contain the letter D', + 'The 7th equation must contain the letter B', + 'The 8th equation must contain a minus sign', + 'The 8th equation must NOT contain the letter B', + 'The 8th equation must NOT contain the letter D', + 'The 8th equation must NOT contain the letter F', + 'The 8th equation must NOT contain the letter I', + 'The 8th equation must contain the letter C', + 'The 8th equation must contain the letter H', + 'The 8th equation must contain the letter A', + 'The 8th equation must contain the letter E', + 'The 8th equation must contain the letter G' + + ]; //INITIALIZE CRYPTO GAME WITH SPECIFIED RULESET - var crypto = new Cryptography(mapping,rules[task_id]); + var crypto = new Cryptography(mapping,rules[task_id] ); - $('#rule_1').text(rule_desc[rules[task_id][0] - 1]); - $('#rule_2').text(rule_desc[rules[task_id][1] - 1]) + $('#rule_0').text(rule_desc[rules[task_id][0] - 1]); + $('#rule_1').text(rule_desc[rules[task_id][1] - 1]); + $('#rule_2').text(rule_desc[rules[task_id][2] - 1]); + $('#rule_3').text(rule_desc[rules[task_id][3] - 1]); + $('#rule_4').text(rule_desc[rules[task_id][4] - 1]); + $('#rule_5').text(rule_desc[rules[task_id][5] - 1]); //WARNS THEM WHEN THEY HAVE A MINUTE LEFT setTimeout(function() { $("#timer-warning").modal(); - }, 540 * 1000); + }, 480 * 1000); //PINGS SERVER PERIODICALLY TO CONFIRM STILL ON PAGE var itv = setInterval(function() { @@ -215,6 +293,8 @@ function clear_timer(){ switch(data.group_task.whose_turn){ //IF EQUATION TURN case 0: + $("#hypothesis-left").val('---'); + $("#hypothesis-right").val('---'); //START IDLE TIMER IF USER IS EQUATIONS if(group_role == 'follower1'){ start_timer(); @@ -244,6 +324,7 @@ function clear_timer(){ break; //IF HYPOTHESIS TURN case 1: + //START IDLE TIMER IF USER IS HYPOTHESES if(group_role == 'follower2'){ start_timer(); @@ -297,11 +378,15 @@ function clear_timer(){ if (data['user']['group_id'].toString() == '{{ $user->group_id }}'){ //INFORM $('#rule_break_num').text(data['rule_broken'].toString()); - $('#penalty_amt').text((2*data['rule_broken']).toString()); + $('#penalty_amt').text((3*data['rule_broken']).toString()); + if(parseFloat($('#payment').text()) <= 0){ + $('#penalty_txt').text('Your completion bonus is already at $0.'); + } $("#rule_broken").modal('toggle'); //UPDATE PAYMENT - sub_amount = 2.00 * data['rule_broken']; + sub_amount = 3.00 * data['rule_broken']; $('#payment').text((((parseFloat($('#payment').text()) - sub_amount) > 0.00) ? (parseFloat($('#payment').text()) - sub_amount) : 0.00).toFixed(2)); + } }); @@ -323,13 +408,21 @@ function clear_timer(){ channel.bind('task-complete', function(data){ if(data['user']['id'].toString() == '{{ $user->id }}'){ $("#task-result").val(1); - - $("#crypto-header").hide(); - $("#crypto-ui").hide(); - $("#task-end").show(); + final_time_remaining = Math.min(60, task_time_remaining); + $('#crypto-ui').html("

Congratulations! You've correctly identified all the letters and solved the puzzle.
In 60 seconds, you'll be sent to a short survey to review with your group. Congrats again!

"); + var final_itv = setInterval(function(){ + final_time_remaining -= 1; + $('#final_timer').text(final_time_remaining); + },1000); + //$("#task-result").val(1); + + //$("#crypto-header").hide(); + //$("#crypto-ui").hide(); + //$("crypto_content").html("

") + //$("#task-end").show(); setTimeout(function(){ $("#cryptography-end-form").submit() - },5000); + },60000); } }); @@ -454,6 +547,8 @@ function clear_timer(){ prompt: "Propose Hypothesis", guess: $("#hypothesis-left").val() + '=' + $("#hypothesis-right").val() + ' : ' + output }, function(data) { + + if(data == 'WAIT'){ $('#submit-hypothesis').text('Waiting for Team'); $('#submit-hypothesis').attr('disabled',true); @@ -505,8 +600,14 @@ function clear_timer(){ //IF MAPPING IS CORRECT, END TASK if(result) { - $("#task-result").val(1); + //$("#task-result").val(1); $('#bonus_amt').val(payment); + //final_time_remaining = Math.min(60, time_remaining); + //$('#crypto-ui').html("

Congratulations! You've correctly identified all the letters and solved the puzzle. As a quick reminder, as the leader your payment depends not only on solving the puzzle, but also on whether you broke any rules and how many rounds you took.

In 60 seconds, you'll soon be sent to a short survey to review your group. Congrats again!

"); + //var final_itv = setInterval(function(){ + //final_time_remaining -= 1; + //$('#final_timer').text(final_time_remaining); + //},1000); $.post('/task-complete', {_token: "{{ csrf_token() }}"}); } @@ -557,11 +658,12 @@ function clear_timer(){
-
+
@if ($user->group_role == "leader")
+
Round 1 of 10

Current Guesses

@foreach($sorted as $key => $el) @@ -586,10 +688,13 @@ function clear_timer(){

Equation rules
- 1. No equation may contain all 10 letters
- 2. The first equation must contain at least 3 letters
- 3. The fifth equation must NOT contain a minus sign
- Breaking a rule costs $2 + 1. No equation may contain all 10 letters
+ 2. The first equation must contain at least 3 letters
+ 3. The fifth equation must NOT contain a minus sign
+ 4. No equation may contain all 10 letters
+ 5. The first equation must contain at least 3 letters
+ 6. The fifth equation must NOT contain a minus sign
+ Breaking a rule costs $3

@@ -597,7 +702,7 @@ function clear_timer(){
-

LEADER PAYMENT: $7.00
+

COMPLETION BONUS: $9.00
Each 'round' costs $0.50


@@ -620,10 +725,10 @@ function clear_timer(){
-
Round 1
+
Round 1 of 10

Enter an equation

Enter the left-hand side of an equation, using letters, addition and - subtraction: e.g. “A+B”. Please only use the letters A-J plus '+' and '-'. + subtraction: e.g. 'A+B'. Please only use the letters A-J plus '+' and '-'.
@@ -653,7 +758,7 @@ function clear_timer(){
-
Trial 1
+
Round 1

Make a hypothesis

Hypothesize the value of a single letter (e.g. F = 7) @@ -742,17 +847,15 @@ function clear_timer(){
Each letter from A to J has a value from 0 to 9. Each letter has a different value. Your goal is to uncover the value of each letter by - completing "rounds". A round has three steps. First you enter an equation + completing 'rounds'. A round has three steps. First you enter an equation (e.g. “A+B”). You can only use addition and subtraction. Second, you - make a hypothesis (e.g. “D=4”) and the computer will tell you if this + make a hypothesis (e.g. 'D=4') and the computer will tell you if this hypothesis is TRUE or FALSE. Third, you can guess the values of each letter. You don’t have to make guesses for all the letters.
Try to find out the value of each letter WITH AS FEW ROUNDS AS - POSSIBLE. You have {{ $maxResponses }} rounds and 10 minutes. If you run out of - rounds, or time, you will get some points for any of the letters - you have correctly identified. + POSSIBLE.