Ver código fonte

Add blended counts to report

Alan Lam 2 anos atrás
pai
commit
79bae85829

+ 1 - 0
template_processing/age_verification_greene_king/reports_create_empty_objects.php

@@ -81,4 +81,5 @@ $total_data = (object) [
 	"barAgeVerificationCounts" => ["pass" => 0, "fail" => 0, "void" => 0],
 
 	"combinedCounts" => ["pass" => 0, "fail" => 0, "void" => 0],
+	"blendedCounts" => ["pass" => 0, "fail" => 0, "void" => 0],
 ];

+ 11 - 0
template_processing/age_verification_greene_king/reports_process_test.php

@@ -122,10 +122,18 @@ if(!$test->void_primary) {
 	$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
@@ -133,6 +141,7 @@ else {
 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 = (bool) ($test_values->bar_age_verification ?? false);
@@ -148,4 +157,6 @@ else if($test->challenge_stage === 5 || $test->void_primary) {
 
 	$data[$key]->combinedCounts[$alcohol_key]++;
 	$total_data->combinedCounts[$alcohol_key]++;
+
+	$total_data->blendedCounts[$alcohol_key]++;
 }

+ 7 - 2
views/reports.php

@@ -394,7 +394,7 @@ let projectData = <?=json_encode($project_table_data)?>;
 			<tr>
 				<th><?=htmlspecialchars($title)?></th>
 				<td class="text-right"><?=$pass?></td>
-				<td class="text-right"><?=$pass_percentage?></td>
+				<td class="text-right"><?=$pass_percentage?>%</td>
 				<td class="text-right"><?=$fail?></td>
 				<td class="text-right"><?=$total?></td>
 				<td class="text-right"><?=$void?></td>
@@ -415,7 +415,7 @@ let projectData = <?=json_encode($project_table_data)?>;
 			<tr>
 				<th></th>
 				<th><?=htmlspecialchars(__("Passes"))?></th>
-				<th><?=htmlspecialchars(__("Pass Rate (%)"))?></th>
+				<th><?=htmlspecialchars(__("Pass Rate"))?></th>
 				<th><?=htmlspecialchars(__("Fails"))?></th>
 				<th><?=htmlspecialchars(__("Total"))?></th>
 				<th><?=htmlspecialchars(__("Voids"))?></th>
@@ -440,6 +440,11 @@ let projectData = <?=json_encode($project_table_data)?>;
 			if(isset($total_data->combinedCounts)) {
 				$render_pass_fail_row("Combined Tests", $total_data->combinedCounts["pass"],  $total_data->combinedCounts["fail"], $total_data->combinedCounts["void"] ?? 0);
 			}
+
+			if(isset($total_data->blendedCounts)) {
+				$render_pass_fail_row("Blended Tests", $total_data->blendedCounts["pass"],  $total_data->blendedCounts["fail"], $total_data->blendedCounts["void"] ?? 0);
+			}
+
 			?>
 			</tbody>
 		</table>