Просмотр исходного кода

Remove "No Challenge" series for line of sight chart

Alan Lam 2 лет назад
Родитель
Сommit
6edeed5438

+ 3 - 0
controllers/reports.php

@@ -509,3 +509,6 @@ if($submit) {
 View::includeOnce("header", compact("page_title"));
 View::include("reports", compact("customer", "date_range", "date_start", "date_end", "date_resolution", "all_projects", "project_table_data", "exclude_project_ids", "location_ids", "retests", "charts", "data", "total_data", "locations_missing_region", "locations_missing_area_manager", "locations_missing_operations_manager", "locations_missing_brand", "region_data", "area_manager_data", "brand_data", "operations_manager_data", "key_labels", "has_pass_fail"));
 View::includeOnce("footer");
+
+file_put_contents("periodic_data.bin", serialize($data));
+file_put_contents("total_data.bin", serialize($total_data));

+ 15 - 7
engine/chart_generator.php

@@ -414,15 +414,20 @@ class ChartGenerator {
 		);
 	}
 
-	public function getPeriodicLineOfSightPassRateChart(string $title = "Pass Rate by Line of Sight"): Chart {
+	public function getPeriodicLineOfSightPassRateChart(array $options = []): Chart {
+		$title = $options["title"] ?? __("Pass Rate by Line of Sight");
+		$include_no_challenge = $options["include_no_challenge"] ?? true;
+
+		$pass_counts = $this->getPeriodicPassRateByLineOfSight(1);
+		$fail_counts = $this->getPeriodicPassRateByLineOfSight(0);
+		$no_challenge_counts = $this->getPeriodicPassRateByLineOfSight(2);
 
 		return $this->getPeriodicPassRateChart(
 			$title,
-			$this->getPeriodicPassRateByLineOfSight(1),
-			$this->getPeriodicPassRateByLineOfSight(0),
-			$this->getPeriodicPassRateByLineOfSight(2)
+			$pass_counts,
+			$fail_counts,
+			$include_no_challenge ? $no_challenge_counts : null
 		);
-
 	}
 
 	public function getPeriodicBarPurchasePassRateChart(): Chart {
@@ -1155,12 +1160,15 @@ class ChartGenerator {
 			if(!isset($data->$pass_field)) return null;
 			if(!isset($data->$fail_field)) return null;
 
-			$test_count = $data->$pass_field[$index] + $data->$fail_field[$index];
+			$pass_count = $data->$pass_field[$index];
+			$fail_count = $data->$fail_field[$index];
+
+			$test_count = $pass_count + $fail_count;
 			if($test_count === 0) {
 				return null;
 			}
 
-			return round(($data->$pass_field[$index] / $test_count) * 100);
+			return round(($pass_count / $test_count) * 100);
 		}, $this->periodicData));
 	}
 

+ 4 - 1
template_processing/age_verification_greene_king/reports_build_charts.php

@@ -25,7 +25,10 @@ if(!empty($venue_type_data)) {
 $charts[] = $generator->getPeriodicPassFailRateChart(__("Gaming Pass / Fail"));
 //$charts[] = $generator->getPeriodicEyeContactChart();
 //$charts[] = $generator->getPeriodicEyeContactPassRateChart();
-$charts[] = $generator->getPeriodicLineOfSightPassRateChart(__("Gaming Pass Rate by Line of Sight"));
+$charts[] = $generator->getPeriodicLineOfSightPassRateChart([
+	"title" => __("Gaming Pass Rate by Line of Sight"),
+	"include_no_challenge" => false
+]);
 $charts[] = $generator->getPeriodicPassRateChartByKey(__("Alcohol Age Verification Rate"), "barAgeVerificationCounts");
 $charts[] = $generator->getPeriodicPassRateChartByKey(__("Alcohol Pass Rate"), "barCounts");
 $charts[] = $generator->getPeriodicTotalsChart(__("Gaming Totals"));