|
|
@@ -1,15 +1,25 @@
|
|
|
-<?php
|
|
|
+<?php /** @noinspection PhpUnhandledExceptionInspection */
|
|
|
+
|
|
|
+/**
|
|
|
+ * @var object[] $fields
|
|
|
+ * @var resource $handle
|
|
|
+ * @var Test[] $tests
|
|
|
+ * @var Constraint $year_cycle_constraint
|
|
|
+ */
|
|
|
|
|
|
$field_names = [
|
|
|
"Test Result", "Test Void",
|
|
|
"Location Name", "Address", "Region", "Internal ID", "Area Manager",
|
|
|
|
|
|
"Date",
|
|
|
+ "All-Time Test Count", "Current Year Period Test Count"
|
|
|
];
|
|
|
|
|
|
foreach($fields as $field) {
|
|
|
$customer_export = $field->customerExport ?? true;
|
|
|
- if(!$customer_export) continue;
|
|
|
+ if(!$customer_export) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
$field_names[] = $field->label;
|
|
|
}
|
|
|
@@ -17,12 +27,14 @@ foreach($fields as $field) {
|
|
|
fputcsv($handle, $field_names);
|
|
|
|
|
|
foreach($tests as $test) {
|
|
|
-
|
|
|
$project = $test->getProject();
|
|
|
$location = $test->getLocation();
|
|
|
$tester = $test->getTester();
|
|
|
$values = $test->getValues(true);
|
|
|
|
|
|
+ $total_test_count = $location->getCompletedTests();
|
|
|
+ $current_test_count = $location->getCompletedTests(["dts_start" => $year_cycle_constraint]);
|
|
|
+
|
|
|
$test_date = "";
|
|
|
$test_start = "";
|
|
|
$test_end = "";
|
|
|
@@ -36,7 +48,7 @@ foreach($tests as $test) {
|
|
|
|
|
|
$output = [];
|
|
|
|
|
|
- if(!is_null($test->pass)) {
|
|
|
+ if($test->pass !== null) {
|
|
|
|
|
|
$result = $test->pass ? "Pass" : "Fail";
|
|
|
|
|
|
@@ -66,6 +78,8 @@ foreach($tests as $test) {
|
|
|
$output[] = $location->internal_id;
|
|
|
$output[] = $location->area_manager;
|
|
|
$output[] = $test_date;
|
|
|
+ $output[] = $total_test_count;
|
|
|
+ $output[] = $current_test_count;
|
|
|
|
|
|
foreach($fields as $field) {
|
|
|
|
|
|
@@ -73,7 +87,7 @@ foreach($tests as $test) {
|
|
|
if(!$customer_export) continue;
|
|
|
|
|
|
$field_name = $field->name;
|
|
|
- $value = isset($test->$field_name) ? $test->$field_name : ($values[$field->name] ?? "");
|
|
|
+ $value = $test->$field_name ?? ($values[$field->name] ?? "");
|
|
|
|
|
|
if(!empty($field->displayStrings)) {
|
|
|
$index = array_search($value, $field->values);
|
|
|
@@ -86,4 +100,3 @@ foreach($tests as $test) {
|
|
|
fputcsv($handle, $output);
|
|
|
}
|
|
|
|
|
|
-?>
|