|
|
@@ -17,6 +17,7 @@ if($user->level >= User::LEVEL_ADMIN) {
|
|
|
$test_id = http::value("test_id", "int");
|
|
|
$location_internal_id = http::value("location_internal_id", "int");
|
|
|
$pass = http::value("pass", "int");
|
|
|
+ $custom = http::value("custom");
|
|
|
|
|
|
$filter_count_offset = 0;
|
|
|
|
|
|
@@ -42,8 +43,6 @@ if($user->level >= User::LEVEL_ADMIN) {
|
|
|
if(strlen($pass) > 0) $nvp["pass"] = $pass;
|
|
|
|
|
|
$filter_count = count($nvp);
|
|
|
- $filter_count += $filter_count_offset;
|
|
|
- if(!$filter_count) $filter_count = "";
|
|
|
|
|
|
$sort = http::value("sort");
|
|
|
switch($sort) {
|
|
|
@@ -60,13 +59,47 @@ if($user->level >= User::LEVEL_ADMIN) {
|
|
|
}
|
|
|
|
|
|
$tests = Test::query($nvp, $query_options);
|
|
|
+ $projects = Project::load(array_column($tests, "project_id"));
|
|
|
+
|
|
|
+ switch($custom) {
|
|
|
+ case "overdue_project":
|
|
|
+ $tests = array_filter($tests, function($test) {
|
|
|
+ if($test->status == Test::STATUS_CANCELLED) return false;
|
|
|
+ $project = $test->getProject();
|
|
|
+
|
|
|
+ $unix_deadline = Util::getUnixTimeFromUTC($project->dts_deadline);
|
|
|
+
|
|
|
+ return ($test->status != Test::STATUS_COMPLETED && time() > $unix_deadline);
|
|
|
+ });
|
|
|
+
|
|
|
+ $filter_count++;
|
|
|
+
|
|
|
+ break;
|
|
|
+ case "overdue_test":
|
|
|
+ $tests = array_filter($tests, function($test) {
|
|
|
+ if($test->status == Test::STATUS_CANCELLED) return false;
|
|
|
+ if(is_null($test->dts_due)) return false;
|
|
|
+
|
|
|
+ $unix_due = Util::getUnixTimeFromUTC($test->dts_due);
|
|
|
+
|
|
|
+ return ($test->status < Test::STATUS_STARTED && time() > $unix_due);
|
|
|
+ });
|
|
|
+
|
|
|
+ $filter_count++;
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ $filter_count += $filter_count_offset;
|
|
|
+ if(!$filter_count) $filter_count = "";
|
|
|
+
|
|
|
$pagination_object = Util::getPaginationObject($tests);
|
|
|
$tests = array_slice($tests, $pagination_object->offset, $pagination_object->pageSize);
|
|
|
|
|
|
$testers = User::load(array_column($tests, "tester_id"));
|
|
|
- $projects = Project::load(array_column($tests, "project_id"));
|
|
|
$customers = Customer::query([], ["sort" => "name"]);
|
|
|
|
|
|
+
|
|
|
usort($projects, function($a, $b) {
|
|
|
return $a->name <=> $b->name;
|
|
|
});
|
|
|
@@ -78,7 +111,7 @@ if($user->level >= User::LEVEL_ADMIN) {
|
|
|
];
|
|
|
|
|
|
View::includeOnce("header", compact("page_title"));
|
|
|
- View::include("test_list", compact("tests", "pagination_object", "sort", "sorts", "projects", "customers", "customer_id", "project_id", "location_id", "location_internal_id", "pass", "test_id", "filter_count", "status"));
|
|
|
+ View::include("test_list", compact("tests", "pagination_object", "sort", "sorts", "projects", "customers", "customer_id", "project_id", "location_id", "location_internal_id", "pass", "custom", "test_id", "filter_count", "status"));
|
|
|
}
|
|
|
|
|
|
// HQ / Venue (view completed tests)
|