Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory integration #5

Open
wants to merge 154 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
d5cee32
integrated memory task with waiting room/session setup
bleonar5 Oct 14, 2021
1463fb2
fixed instructions bug
bleonar5 Oct 15, 2021
48ee215
quick fix to combined memory pilot (typo)
bleonar5 Oct 18, 2021
cc7013d
edits requested by Ben for group memory
bleonar5 Oct 18, 2021
052695e
edits requested by Ben for group memory
bleonar5 Oct 18, 2021
b36c243
edits requested by Ben for group memory
bleonar5 Oct 18, 2021
0e250ff
edits requested by Ben for group memory
bleonar5 Oct 18, 2021
fe58766
edits requested by Ben for group memory
bleonar5 Oct 18, 2021
1051116
edits requested by Ben for group memory
bleonar5 Oct 18, 2021
b37c4ab
major timing adjustments on account of design changes (in memory, tim…
bleonar5 Oct 20, 2021
91b6da2
final cosmetic adjustments for phase 1 + 2 of memory
bleonar5 Oct 22, 2021
298c272
final cosmetic adjustments for phase 1 + 2 of memory
bleonar5 Oct 22, 2021
282d15d
final cosmetic adjustments for phase 1 + 2 of memory
bleonar5 Oct 22, 2021
043c63f
final cosmetic updates, fixed 'change perspective' button, and update…
bleonar5 Oct 27, 2021
5b064ff
final cosmetic updates, fixed 'change perspective' button, and update…
bleonar5 Oct 27, 2021
ad1ccd9
changed consent text
bleonar5 Oct 27, 2021
fdacab1
added storys timer
bleonar5 Oct 27, 2021
21c710c
temporarily removed role_selection page
bleonar5 Oct 27, 2021
c15afa8
temporarily removed role_selection page
bleonar5 Oct 27, 2021
e4d8d0f
temporarily removed role_selection page
bleonar5 Oct 27, 2021
cf5238d
temporarily removed role_selection page
bleonar5 Oct 27, 2021
ad6cca5
temporarily removed role_selection page
bleonar5 Oct 27, 2021
43c62e3
temporarily removed role_selection page
bleonar5 Oct 27, 2021
d60dfcf
temporarily removed role_selection page
bleonar5 Oct 27, 2021
8adefc5
temporarily removed role_selection page
bleonar5 Oct 27, 2021
e081b7b
temporarily removed role_selection page
bleonar5 Oct 27, 2021
6283624
temporarily removed role_selection page
bleonar5 Oct 27, 2021
d7c5f5d
fixes to status changes on group memory, fixed lock-unlock functional…
bleonar5 Oct 28, 2021
fc6cdab
temporarily removed role_selection page
bleonar5 Oct 28, 2021
7043bc1
temporarily removed role_selection page
bleonar5 Oct 28, 2021
c4b063a
temporarily removed role_selection page
bleonar5 Oct 28, 2021
8292a88
temporarily removed role_selection page
bleonar5 Oct 28, 2021
7ed3a49
temporarily removed role_selection page
bleonar5 Oct 28, 2021
61c08f5
temporarily removed role_selection page
bleonar5 Oct 28, 2021
ac4b5e3
added incognito page and fixed login issues
bleonar5 Oct 29, 2021
862f233
added incognito page and fixed login issues
bleonar5 Oct 29, 2021
42c3c8d
added incognito page and fixed login issues
bleonar5 Oct 29, 2021
77a66b9
added incognito page and fixed login issues
bleonar5 Oct 29, 2021
45f97d5
added incognito page and fixed login issues
bleonar5 Oct 29, 2021
4f70b23
added incognito page and fixed login issues
bleonar5 Oct 29, 2021
5e4e5a2
cosmetic changes and fix for straggler bug
bleonar5 Nov 3, 2021
6047fee
individual cosmetic adjustments and minor bug fixes
bleonar5 Nov 5, 2021
95ab8cc
individual cosmetic adjustments and minor bug fixes
bleonar5 Nov 5, 2021
b09fb6c
individual cosmetic adjustments and minor bug fixes
bleonar5 Nov 5, 2021
f1ca11c
individual cosmetic adjustments and minor bug fixes
bleonar5 Nov 5, 2021
998d223
individual cosmetic adjustments and minor bug fixes
bleonar5 Nov 5, 2021
f963a7d
individual cosmetic adjustments and minor bug fixes
bleonar5 Nov 5, 2021
2ff262f
minor fixes to crypto individual
bleonar5 Nov 8, 2021
db7eee0
minor fixes to crypto individual
bleonar5 Nov 8, 2021
a834ca5
minor fixes to crypto individual
bleonar5 Nov 8, 2021
c089a37
leadership edits
bleonar5 Nov 9, 2021
446044b
design changes
bleonar5 Nov 18, 2021
70e6874
remove device check
bleonar5 Nov 18, 2021
e50c649
remove device check
bleonar5 Nov 18, 2021
cf6308f
remove device check
bleonar5 Nov 18, 2021
c47caaa
remove device check
bleonar5 Nov 18, 2021
948d568
remove device check
bleonar5 Nov 18, 2021
5280d14
remove device check
bleonar5 Nov 19, 2021
26f5096
remove device check
bleonar5 Nov 19, 2021
04154ad
remove device check
bleonar5 Nov 19, 2021
7acc906
remove device check
bleonar5 Nov 19, 2021
5c929cb
remove device check
bleonar5 Nov 19, 2021
6bcf674
remove device check
bleonar5 Nov 19, 2021
a3ccfc2
added randomization scheme to AssignGroups
bleonar5 Nov 22, 2021
2983675
added randomization scheme to AssignGroups
bleonar5 Nov 22, 2021
4a9bca9
added randomization scheme to AssignGroups
bleonar5 Nov 22, 2021
514a1ca
added randomization scheme to AssignGroups
bleonar5 Nov 22, 2021
89b74e6
added randomization scheme to AssignGroups
bleonar5 Nov 22, 2021
cc772c7
added randomization scheme to AssignGroups
bleonar5 Nov 22, 2021
4be6ed4
added randomization scheme to AssignGroups
bleonar5 Nov 22, 2021
ea75b0a
added randomization scheme to AssignGroups
bleonar5 Nov 22, 2021
90fb642
added mic level check for device check
bleonar5 Nov 24, 2021
535efc8
added mic level check for device check
bleonar5 Nov 24, 2021
7565b23
added alt crypto intro timing/text, other fixes and changes
bleonar5 Nov 28, 2021
4b607d9
added video feed to devicecheck
bleonar5 Nov 29, 2021
f3d1081
fixed device check style
bleonar5 Nov 29, 2021
e62fe77
added video feed to devicecheck
bleonar5 Nov 29, 2021
8173d6a
added video feed to devicecheck
bleonar5 Nov 29, 2021
61a6eab
added video feed to devicecheck
bleonar5 Nov 29, 2021
2538f57
added video feed to devicecheck
bleonar5 Nov 29, 2021
0d116b4
fixed admin-page timer bug
bleonar5 Nov 29, 2021
1f0d73c
added send to conclusion function
bleonar5 Dec 1, 2021
6981afb
changed timings and made instruction text dependent on timing variables
bleonar5 Dec 6, 2021
ae63e11
changed timings and made instruction text dependent on timing variables
bleonar5 Dec 6, 2021
52ff00d
fixed admin-page timer bug
bleonar5 Dec 6, 2021
8c30cd6
fixed admin-page timer bug
bleonar5 Dec 6, 2021
0d22170
changed timings and made instruction text dependent on timing variables
bleonar5 Dec 6, 2021
130996f
changed timings and made instruction text dependent on timing variables
bleonar5 Dec 6, 2021
5c16b55
changed timings and made instruction text dependent on timing variables
bleonar5 Dec 6, 2021
9c6d1cc
fixed admin-page timer bug
bleonar5 Dec 6, 2021
c2843ef
changed css for memory and added individual crypto to end of memory p…
bleonar5 Dec 8, 2021
578a294
changed css for memory and added individual crypto to end of memory p…
bleonar5 Dec 8, 2021
7357b96
changed css for memory and added individual crypto to end of memory p…
bleonar5 Dec 8, 2021
3e64625
edits for phase three link
bleonar5 Dec 13, 2021
89dab7c
edits for phase three link
bleonar5 Dec 13, 2021
062bafb
edits for phase three link
bleonar5 Dec 13, 2021
84b904b
added crypto link
bleonar5 Dec 13, 2021
15275e5
added crypto link
bleonar5 Dec 13, 2021
1121ee3
yourslef edit
bleonar5 Jan 11, 2022
0b605d9
changes to download data
bleonar5 Jan 19, 2022
a443d7d
changes to download data
bleonar5 Jan 19, 2022
ee6ba16
changes to download data
bleonar5 Jan 19, 2022
fd3a9ba
changes to download data
bleonar5 Jan 19, 2022
88a2812
changes to download data
bleonar5 Jan 19, 2022
a1c2fc5
changes to download data
bleonar5 Jan 19, 2022
c8ce05c
changes to download data
bleonar5 Jan 19, 2022
55090c9
added rules to individual etc
bleonar5 Feb 3, 2022
3037058
git
bleonar5 Feb 8, 2022
870cf5a
git
bleonar5 Feb 8, 2022
e064802
git
bleonar5 Feb 8, 2022
d8c3e3f
added three stage changes
bleonar5 Feb 23, 2022
2bf03f4
commit
bleonar5 Feb 25, 2022
ccdbf57
git
bleonar5 Mar 1, 2022
2f94994
commit
bleonar5 Mar 3, 2022
4b5821e
git
bleonar5 Mar 3, 2022
d69cfc9
git
bleonar5 Mar 3, 2022
717535d
git
bleonar5 Mar 8, 2022
20022fc
git
bleonar5 Mar 8, 2022
49271bb
git
bleonar5 Mar 8, 2022
2eb821e
git
bleonar5 Mar 8, 2022
0957912
git
bleonar5 Mar 8, 2022
a9779e3
git
bleonar5 Mar 8, 2022
c254e2f
git
bleonar5 Mar 8, 2022
dbb49f9
git
bleonar5 Mar 10, 2022
6a80e54
git
bleonar5 Mar 10, 2022
867ef80
git
bleonar5 Mar 15, 2022
69d56a6
git
bleonar5 Mar 15, 2022
001d20c
git
bleonar5 Mar 17, 2022
ee92e4b
git
bleonar5 Mar 17, 2022
f6a0de7
git
bleonar5 Mar 24, 2022
a1a7834
git
bleonar5 Mar 24, 2022
cc0164a
git
bleonar5 Mar 28, 2022
7701b59
git
bleonar5 Mar 28, 2022
f1f2230
git
bleonar5 Mar 28, 2022
91161f0
git
bleonar5 Mar 28, 2022
0c3561c
git
bleonar5 Mar 28, 2022
b0aeb19
git
bleonar5 Apr 1, 2022
64455da
git
bleonar5 Apr 4, 2022
f4420d3
git
bleonar5 Apr 4, 2022
c34699b
git
bleonar5 Apr 5, 2022
5595c5d
git
bleonar5 Apr 6, 2022
ace0e8b
git
bleonar5 Apr 8, 2022
748ed0b
git
bleonar5 Apr 11, 2022
78dee14
git
bleonar5 Apr 11, 2022
c4dc45c
git
bleonar5 Apr 11, 2022
917176c
git
bleonar5 Apr 11, 2022
5192ed3
git
bleonar5 Apr 13, 2022
173483d
git
bleonar5 Apr 26, 2022
d9fe6c3
git
bleonar5 May 10, 2022
439a8b7
agora upgrade
bleonar5 Aug 30, 2022
c552255
git
bleonar5 Sep 7, 2022
482b52b
git
bleonar5 Sep 7, 2022
33b4a45
git
bleonar5 Sep 7, 2022
fdb666c
git
bleonar5 Sep 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Events/LeaderAnswered.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(User $user)
*/
public function broadcastOn()
{
return ['memory-channel'];
return ['task-channel'];
}

public function broadcastAs()
Expand Down
89 changes: 68 additions & 21 deletions app/GroupTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"}},
Expand All @@ -110,6 +111,39 @@ 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 = '[
Expand Down Expand Up @@ -139,9 +173,9 @@ public static function initializeTestTasks($group_id, $randomize) {
return Self::initializeTasks($group_id, $taskArray, $randomize);
}

public static function initializeConclusionTasks($group_id, $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"}}
{"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);
Expand All @@ -153,22 +187,51 @@ public static function initializeCryptoTasks($group_id, $randomize,$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"}}
]';
}
else{
$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":"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 = '[
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this all stringified?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a major holdover from Gabe's design that I chose to integrate rather than rebuild. I think if I had to justify why he did it this way, it's because we have generalized tables for GroupTasks and IndividualTasks, all of which have different subtypes (for instance, cryptography vs memory), and each subtype has some parameters that don't overlap with the other subtypes. So I think in order to avoid a prohibitively wide table and to keep these parameters accessible in a generalized way, he stringified these arrays so he could store them in one column called "parameters"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see okay, thanks for clarifying. Figured that this was a holdover but was curious about it

{"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) {
$taskArray = '[
Expand Down Expand Up @@ -306,25 +369,9 @@ 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) {
$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"}}
]';
return Self::initializeTasks($group_id, $taskArray, $randomize);
}




Expand Down
5 changes: 3 additions & 2 deletions app/Http/Controllers/AjaxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
Expand All @@ -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) {
Expand Down
21 changes: 19 additions & 2 deletions app/Http/Controllers/GroupTaskController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,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);
Expand Down Expand Up @@ -248,6 +256,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'])
Expand All @@ -261,6 +272,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);
Expand All @@ -282,15 +294,18 @@ 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
$isReporter = $this->isReporter(\Auth::user()->id, \Auth::user()->group_id);

$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
Expand Down Expand Up @@ -729,6 +744,8 @@ public function cryptographyIntro(Request $request) {

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'));
Expand Down
56 changes: 50 additions & 6 deletions app/Http/Controllers/IndividualTaskController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -214,15 +217,35 @@ public function groupSurvey(Request $request){

$time_elapsed = $session_start->created_at->diffInSeconds(\Carbon\Carbon::now());

$task_length = env('TASK_LENGTH',300);
if($admin->waiting == 1)
$task_length = env('CRYPTO_TASK_LENGTH',300);
else
$task_length = env('MEMORY_TASK_LENGTH',300);

$survey_length = env('SURVEY_LENGTH',120);

$buffer_length = env('BUFFER_LENGTH',30);

$session_length = $task_length + $survey_length + $buffer_length;
$intro_length = env('MEMORY_INTRO_LENGTH',300);

$alt_intro_length = env('MEMORY_ALT_INTRO_LENGTH',30);

if($admin->waiting == 2){
$alt_task_length = $task_length - $intro_length + $alt_intro_length;

$session_length = $task_length + $survey_length + $buffer_length;

$alt_session_length = $alt_task_length + $survey_length + $buffer_length;


$time_remaining = $alt_session_length * ($admin->current_session - 1) + $session_length - $time_elapsed - $buffer_length;
}
else{
$session_length = $task_length + $survey_length + $buffer_length;

$time_remaining = $session_length * ($admin->current_session) - $time_elapsed - $buffer_length;
}

$time_remaining = $session_length * $admin->current_session - $time_elapsed - $buffer_length;

}
else
Expand All @@ -232,6 +255,7 @@ 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('user',$this_user);
}

Expand All @@ -253,15 +277,34 @@ public function groupSurvey(Request $request){

$time_elapsed = $session_start->created_at->diffInSeconds(\Carbon\Carbon::now());

$task_length = env('TASK_LENGTH',300);
if($admin->waiting == 1)
$task_length = env('CRYPTO_TASK_LENGTH',300);
else
$task_length = env('MEMORY_TASK_LENGTH',300);

$survey_length = env('SURVEY_LENGTH',120);

$buffer_length = env('BUFFER_LENGTH',30);

$session_length = $task_length + $survey_length + $buffer_length;
$intro_length = env('MEMORY_INTRO_LENGTH',300);

$time_remaining = $session_length * $admin->current_session - $time_elapsed - $buffer_length;
$alt_intro_length = env('MEMORY_ALT_INTRO_LENGTH',30);

if($admin->waiting == 2){
$alt_task_length = $task_length - $intro_length + $alt_intro_length;

$session_length = $task_length + $survey_length + $buffer_length;

$alt_session_length = $alt_task_length + $survey_length + $buffer_length;


$time_remaining = $alt_session_length * ($admin->current_session - 1) + $session_length - $time_elapsed - $buffer_length;
}
else{
$session_length = $task_length + $survey_length + $buffer_length;

$time_remaining = $session_length * ($admin->current_session) - $time_elapsed - $buffer_length;
}

}
else
Expand All @@ -271,6 +314,7 @@ 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('user',$this_user);
}

Expand Down
Loading