|
|
@@ -70,6 +70,18 @@ switch($action) {
|
|
|
"location_id" => array_column($locations, "id")
|
|
|
]);
|
|
|
|
|
|
+ // Get projects
|
|
|
+ $projects = Project::load(array_column($tests, "project_id"));
|
|
|
+
|
|
|
+ // Filter tests to current year only
|
|
|
+ $tests = array_filter($tests, function($test) {
|
|
|
+ $project = $test->getProject();
|
|
|
+ $project_unix_start = strtotime($project->dts_start);
|
|
|
+ $project_year = date("Y", $project_unix_start);
|
|
|
+ $current_year = date("Y");
|
|
|
+ return $current_year == $project_year;
|
|
|
+ });
|
|
|
+
|
|
|
$location_test_array = [];
|
|
|
foreach($tests as $test) {
|
|
|
$exists = isset($location_test_array[$test->location_id]);
|
|
|
@@ -88,9 +100,6 @@ switch($action) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // Get projects
|
|
|
- $projects = Project::load(array_column($location_test_array, "project_id"));
|
|
|
-
|
|
|
// Start output
|
|
|
foreach($locations as $location) {
|
|
|
|