Procházet zdrojové kódy

Update report test count table to include merged counts and updated column order

Alan Lam před 2 roky
rodič
revize
fc08350dc1

+ 3 - 2
template_processing/age_verification_greene_king/reports_create_empty_objects.php

@@ -80,6 +80,7 @@ $total_data = (object) [
 	"barCounts" => ["pass" => 0, "fail" => 0, "void" => 0],
 	"barAgeVerificationCounts" => ["pass" => 0, "fail" => 0, "void" => 0],
 
-	"combinedCounts" => ["pass" => 0, "fail" => 0, "void" => 0],
-	"blendedCounts" => ["pass" => 0, "fail" => 0, "void" => 0],
+	"mergedCounts" => ["pass" => 0, "fail" => 0, "void" => 0], // Gaming or Alcohol Pass = Pass
+	"combinedCounts" => ["pass" => 0, "fail" => 0, "void" => 0], // Gaming + Alcohol
+	"blendedCounts" => ["pass" => 0, "fail" => 0, "void" => 0], // Gaming + Assumed Alcohol
 ];

+ 20 - 7
template_processing/age_verification_greene_king/reports_process_test.php

@@ -44,6 +44,9 @@ $increment_periodic_pass_fail = static function($value, $pass, $prefix) use (&$d
 	$data[$key]->$field[$index]++;
 };
 
+$gaming_pass = null;
+$alcohol_pass = null;
+
 if(!$test->void_primary) {
 	$stage_key = "stage" . $test->challenge_stage . "Count";
 	$data[$key]->$stage_key++;
@@ -51,9 +54,9 @@ if(!$test->void_primary) {
 
 	$line_of_sight = $test_values->play_machine_line_of_sight ?? null;
 	$eye_contact = $test->challenger_eye_contact ?? null;
-	$pass = (bool) $test->pass;
+	$gaming_pass = (bool) $test->pass;
 
-	if($test->pass) {
+	if($gaming_pass) {
 		$data[$key]->passCount++;
 		$total_data->passCount++;
 		if($region) $region_data[$region][$key]->passCount++;
@@ -70,12 +73,12 @@ if(!$test->void_primary) {
 		if($operations_manager) $operations_manager_data[$operations_manager][$key]->failCount++;
 	}
 
-	$pass_key = $pass ? "pass" : "fail";
+	$pass_key = $gaming_pass ? "pass" : "fail";
 	$data[$key]->combinedCounts[$pass_key]++;
 	$total_data->combinedCounts[$pass_key]++;
 
-	$increment_periodic_pass_fail($eye_contact, $pass, "eyeContact");
-	$increment_periodic_pass_fail($line_of_sight, $pass, "lineOfSight");
+	$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++;
@@ -144,8 +147,8 @@ if($test->void_secondary) {
 	$total_data->blendedCounts["void"]++;
 }
 else if($test->challenge_stage === 5 || $test->void_primary) {
-	$av = (bool) ($test_values->bar_age_verification ?? false);
-	$av_key = $av ? "pass" : "fail";
+	$alcohol_pass = (bool) ($test_values->bar_age_verification ?? false);
+	$av_key = $alcohol_pass ? "pass" : "fail";
 	$data[$key]->barAgeVerificationCounts[$av_key]++;
 	$total_data->barAgeVerificationCounts[$av_key]++;
 
@@ -160,3 +163,13 @@ else if($test->challenge_stage === 5 || $test->void_primary) {
 
 	$total_data->blendedCounts[$alcohol_key]++;
 }
+
+if($gaming_pass || $alcohol_pass) {
+	$total_data->mergedCounts["pass"]++;
+}
+elseif($gaming_pass === false || $alcohol_pass === false) {
+	$total_data->mergedCounts["fail"]++;
+}
+else {
+	$total_data->mergedCounts["void"]++;
+}

+ 58 - 43
views/reports.php

@@ -393,61 +393,76 @@ let projectData = <?=json_encode($project_table_data)?>;
 			?>
 			<tr>
 				<th><?=htmlspecialchars($title)?></th>
+				<td class="text-right"><?=$total?></td>
 				<td class="text-right"><?=$pass?></td>
-				<td class="text-right"><?=$pass_percentage?>%</td>
 				<td class="text-right"><?=$fail?></td>
-				<td class="text-right"><?=$total?></td>
+				<td class="text-right"><?=$pass_percentage?>%</td>
 				<td class="text-right"><?=$void?></td>
 			</tr>
 			<?php
 		};
 		?>
 
-		<table class="table table-sm table-bordered">
-			<colgroup>
-				<col style="width: 16%"/>
-				<col style="width: 16%"/>
-				<col style="width: 16%"/>
-				<col style="width: 16%"/>
-				<col style="width: 16%"/>
-			</colgroup>
-			<thead>
-			<tr>
-				<th></th>
-				<th><?=htmlspecialchars(__("Passes"))?></th>
-				<th><?=htmlspecialchars(__("Pass Rate"))?></th>
-				<th><?=htmlspecialchars(__("Fails"))?></th>
-				<th><?=htmlspecialchars(__("Total"))?></th>
-				<th><?=htmlspecialchars(__("Voids"))?></th>
-			</tr>
-			</thead>
-			<tbody>
-			<tr>
-				<th><?=htmlspecialchars(__("Venue Tests"))?></th>
-				<td colspan="3"></td>
-				<td class="text-right"><?=htmlspecialchars($total_data->testCount)?></td>
-				<td class="text-right"><?=htmlspecialchars($total_data->voidCount)?></td>
-			</tr>
-			<?php
-			if(isset($total_data->passCount)) {
-				$render_pass_fail_row("Gaming Tests", $total_data->passCount, $total_data->failCount, $total_data->gamingCounts["void"] ?? 0);
-			}
+		<section class="mb-4">
+			<table class="table table-sm table-bordered mb-0">
+				<colgroup>
+					<col style="width: 30%"/>
+					<col style="width: 14%"/>
+					<col style="width: 14%"/>
+					<col style="width: 14%"/>
+					<col style="width: 14%"/>
+					<col style="width: 14%"/>
+				</colgroup>
+				<thead>
+				<tr>
+					<th><?=htmlspecialchars(__("Type"))?></th>
+					<th><?=htmlspecialchars(__("Total"))?></th>
+					<th><?=htmlspecialchars(__("Passes"))?></th>
+					<th><?=htmlspecialchars(__("Fails"))?></th>
+					<th><?=htmlspecialchars(__("Pass Rate"))?></th>
+					<th><?=htmlspecialchars(__("Voids"))?></th>
+				</tr>
+				</thead>
+				<tbody>
+				<tr>
+					<th><?=htmlspecialchars(__("Venue Tests"))?></th>
+					<td class="text-right"><?=htmlspecialchars($total_data->testCount)?></td>
+					<td></td>
+					<td></td>
+					<td></td>
+					<td class="text-right"><?=htmlspecialchars($total_data->voidCount)?></td>
+				</tr>
+				<?php
+				if(isset($total_data->passCount)) {
+					$render_pass_fail_row(__("Gaming Tests"), $total_data->passCount, $total_data->failCount, $total_data->gamingCounts["void"] ?? 0);
+				}
 
-			if(isset($total_data->barCounts)) {
-				$render_pass_fail_row("Alcohol Tests", $total_data->barCounts["pass"],  $total_data->barCounts["fail"], $total_data->barCounts["void"] ?? 0);
-			}
+				if(isset($total_data->barCounts)) {
+					$render_pass_fail_row(__("Alcohol Tests"), $total_data->barCounts["pass"],  $total_data->barCounts["fail"], $total_data->barCounts["void"] ?? 0);
+				}
 
-			if(isset($total_data->combinedCounts)) {
-				$render_pass_fail_row("Combined Tests", $total_data->combinedCounts["pass"],  $total_data->combinedCounts["fail"], $total_data->combinedCounts["void"] ?? 0);
-			}
+				?>
+				<tr>
+					<th class="bg-light" colspan="6"><?=htmlspecialchars(__("Aggregate Counts"))?></th>
+				</tr>
+				<?php
 
-			if(isset($total_data->blendedCounts)) {
-				$render_pass_fail_row("Blended Tests", $total_data->blendedCounts["pass"],  $total_data->blendedCounts["fail"], $total_data->blendedCounts["void"] ?? 0);
-			}
+				if(isset($total_data->combinedCounts)) {
+					$render_pass_fail_row(__("Gaming and Alcohol"), $total_data->combinedCounts["pass"],  $total_data->combinedCounts["fail"], $total_data->combinedCounts["void"] ?? 0);
+				}
 
-			?>
-			</tbody>
-		</table>
+				if(isset($total_data->blendedCounts)) {
+					$render_pass_fail_row(__("Gaming and Assumed Alcohol"), $total_data->blendedCounts["pass"],  $total_data->blendedCounts["fail"], $total_data->blendedCounts["void"] ?? 0);
+				}
+
+				if(isset($total_data->mergedCounts)) {
+					$render_pass_fail_row(__("Gaming or Alcohol Pass"), $total_data->mergedCounts["pass"],  $total_data->mergedCounts["fail"], $total_data->mergedCounts["void"] ?? 0);
+				}
+
+				?>
+				</tbody>
+			</table>
+		</section>
 
 		<div class="row mb-4">
 			<div class="col-md-4 d-print-none" style="position: relative;">