|
@@ -4,6 +4,7 @@ namespace Exports;
|
|
|
|
|
|
|
|
use Exception;
|
|
use Exception;
|
|
|
use Location;
|
|
use Location;
|
|
|
|
|
+use Test;
|
|
|
|
|
|
|
|
class LocationCsvExport {
|
|
class LocationCsvExport {
|
|
|
|
|
|
|
@@ -26,12 +27,28 @@ class LocationCsvExport {
|
|
|
$handle = fopen("php://output", "wb");
|
|
$handle = fopen("php://output", "wb");
|
|
|
|
|
|
|
|
fputcsv($handle, [
|
|
fputcsv($handle, [
|
|
|
- "ID", "Internal ID", "City", "Legal Entity", "Brand", "Region", "Area Manager", "Area Manager Email", "Open", "Close", "Name", "Address", "Postcode", "Email", "Latitude", "Longitude", "Archived", "Closed", "Created", "Updated", "Updated By"
|
|
|
|
|
|
|
+ "ID", "Internal ID", "City", "Legal Entity", "Brand", "Region", "Area Manager", "Area Manager Email", "Open", "Close", "Name", "Address", "Postcode", "Email", "Latitude", "Longitude", "Archived", "Closed", "Created", "Updated", "Updated By", "Last Test Date", "Last Gaming Test Result",
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
foreach($this->locations as $location) {
|
|
foreach($this->locations as $location) {
|
|
|
$entries = $location->getUpdateLogEntries([], ["limit" => 1]);
|
|
$entries = $location->getUpdateLogEntries([], ["limit" => 1]);
|
|
|
$entry = $entries[0] ?? null;
|
|
$entry = $entries[0] ?? null;
|
|
|
|
|
+ $completed_tests = $location->getCompletedTests();
|
|
|
|
|
+ /** @var Test $completed_test */
|
|
|
|
|
+ $completed_test = array_shift($completed_tests);
|
|
|
|
|
+
|
|
|
|
|
+ $last_test_date = "";
|
|
|
|
|
+ $last_test_result = "";
|
|
|
|
|
+
|
|
|
|
|
+ if($completed_test) {
|
|
|
|
|
+ $last_test_date = $completed_test->getDisplayDate();
|
|
|
|
|
+ if($completed_test->isVoid()) {
|
|
|
|
|
+ $last_test_result = "Void";
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ $last_test_result = $completed_test->isPass() ? "Pass" : "Fail";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
fputcsv($handle, [
|
|
fputcsv($handle, [
|
|
|
$location->id,
|
|
$location->id,
|
|
@@ -55,6 +72,8 @@ class LocationCsvExport {
|
|
|
$location->dts_created,
|
|
$location->dts_created,
|
|
|
$entry ? $entry->dts : "",
|
|
$entry ? $entry->dts : "",
|
|
|
$entry ? $entry->getUser()->getDisplayName() : "",
|
|
$entry ? $entry->getUser()->getDisplayName() : "",
|
|
|
|
|
+ $last_test_date,
|
|
|
|
|
+ $last_test_result
|
|
|
]);
|
|
]);
|
|
|
}
|
|
}
|
|
|
|
|
|