Pārlūkot izejas kodu

Remove current year filter

Alan Lam 6 gadi atpakaļ
vecāks
revīzija
8849707520
1 mainītis faili ar 9 papildinājumiem un 11 dzēšanām
  1. 9 11
      controllers/user_ajax.php

+ 9 - 11
controllers/user_ajax.php

@@ -1,4 +1,4 @@
-<?php
+<?php /** @noinspection PhpUnhandledExceptionInspection */
 
 JSON::header();
 
@@ -61,6 +61,12 @@ switch($action) {
 
 		// Sort locations by distance
 		usort($locations, function($a, $b) use ($address) {
+
+			/**
+			 * @var Location $a
+			 * @var Location $b
+			 */
+
 			return
 			Geolocation::getDistance($address->getGeolocation(), $a->getGeolocation())
 			<=>
@@ -77,15 +83,6 @@ switch($action) {
 		// 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]);
@@ -119,6 +116,7 @@ switch($action) {
 			$customer_slug = str_replace("-", "_", Util::slug($customer->name));
 
 			// Test
+			/** @var User $tester */
 			$tester = null;
 			$formatted_start_dts = null;
 			$formatted_due_dts = null;
@@ -221,4 +219,4 @@ switch($action) {
 
 
 		break;
-}
+}