$field[$index]++; }; $gaming_pass = null; $alcohol_pass = null; if(!$test->void_primary) { $stage_key = "stage" . $test->challenge_stage . "Count"; $data[$key]->$stage_key++; $total_data->{$stage_key}++; $line_of_sight = $test_values->play_machine_line_of_sight ?? null; $eye_contact = $test->challenger_eye_contact ?? null; $gaming_pass = (bool) $test->pass; if($gaming_pass) { $data[$key]->passCount++; $total_data->passCount++; if($region) $region_data[$region][$key]->passCount++; if($area_manager) $area_manager_data[$area_manager][$key]->passCount++; if($brand) $brand_data[$brand][$key]->passCount++; if($operations_manager) $operations_manager_data[$operations_manager][$key]->passCount++; if($gaming_manager) $gaming_manager_data[$gaming_manager][$key]->passCount++; if($senior_gaming_manager) $senior_gaming_manager_data[$senior_gaming_manager][$key]->passCount++; } else { $data[$key]->failCount++; $total_data->failCount++; if($region) $region_data[$region][$key]->failCount++; if($area_manager) $area_manager_data[$area_manager][$key]->failCount++; if($brand) $brand_data[$brand][$key]->failCount++; if($operations_manager) $operations_manager_data[$operations_manager][$key]->failCount++; if($gaming_manager) $gaming_manager_data[$gaming_manager][$key]->failCount++; if($senior_gaming_manager) $senior_gaming_manager_data[$senior_gaming_manager][$key]->failCount++; } $pass_key = $gaming_pass ? "pass" : "fail"; $data[$key]->combinedCounts[$pass_key]++; $total_data->combinedCounts[$pass_key]++; $increment_periodic_pass_fail($eye_contact, $gaming_pass, "eyeContact"); $increment_periodic_pass_fail($line_of_sight, $gaming_pass, "lineOfSight"); if($test->challenger_gender === "M") { $data[$key]->maleChallengerCount++; $total_data->maleChallengerCount++; } else if($test->challenger_gender === "F") { $data[$key]->femaleChallengerCount++; $total_data->femaleChallengerCount++; } else { $data[$key]->unspecifiedChallengerCount++; $total_data->unspecifiedChallengerCount++; } // Eye Contact if($test->challenger_eye_contact === null) { ++$data[$key]->eyeContactCounts[2]; } else if($test->challenger_eye_contact) { ++$data[$key]->eyeContactCounts[0]; } else { ++$data[$key]->eyeContactCounts[1]; } // Genders Comparison $gender_prefix = ""; switch($test->challenger_gender) { case "M": $gender_prefix = "male"; break; case "F": $gender_prefix = "female"; break; default: $gender_prefix = "unknown"; break; } $gender_prefix .= "Challenge"; if($gender_prefix !== "unknownChallenge") { switch($tester->gender) { case "M": $gender_prefix .= "Male"; break; case "F": $gender_prefix .= "Female"; break; default: $gender_prefix = "unknownChallenge"; break; } } $data[$key]->{$gender_prefix . "Count"}++; $data[$key]->{$gender_prefix . "Stages"}[$test->challenge_stage - 1]++; if($test->pass) $data[$key]->{$gender_prefix . "PassCount"}++; if($test->pass) { $total_data->blendedCounts["pass"] += 2; } else { $total_data->blendedCounts["fail"]++; } } else { $total_data->gamingCounts["void"]++; $total_data->combinedCounts["void"]++; $total_data->blendedCounts["void"]++; } // Alcohol Pass/Fail if($test->void_secondary) { $total_data->barCounts["void"]++; $total_data->combinedCounts["void"]++; $total_data->blendedCounts["void"]++; } else if($test->challenge_stage === 5 || $test->void_primary) { $av_pass = (bool) ($test_values->bar_age_verification ?? false); $av_key = $av_pass ? "pass" : "fail"; $data[$key]->barAgeVerificationCounts[$av_key]++; $total_data->barAgeVerificationCounts[$av_key]++; $alcohol_purchased = (bool) ($test_values->alcohol_purchased ?? false); $alcohol_pass = ($alcohol_purchased === false); $alcohol_key = $alcohol_pass ? "pass" : "fail"; $data[$key]->barCounts[$alcohol_key]++; $total_data->barCounts[$alcohol_key]++; $data[$key]->combinedCounts[$alcohol_key]++; $total_data->combinedCounts[$alcohol_key]++; $total_data->blendedCounts[$alcohol_key]++; } if($gaming_pass || $alcohol_pass) { $total_data->mergedCounts["pass"]++; } elseif($alcohol_pass === false || $test->challenge_stage === 3 || $test->challenge_stage === 4) { $total_data->mergedCounts["fail"]++; } else { $total_data->mergedCounts["void"]++; }