Просмотр исходного кода

Add "Retest" filter in test list

Alan Lam 3 лет назад
Родитель
Сommit
474c62a499
2 измененных файлов с 39 добавлено и 2 удалено
  1. 11 1
      controllers/tests_admin_list.php
  2. 28 1
      views/test_list.php

+ 11 - 1
controllers/tests_admin_list.php

@@ -84,6 +84,7 @@ $test_id = http::value("test_id", "int");
 $tester_id = http::value("tester_id", "int");
 $location_internal_id = http::value("location_internal_id", "int");
 $pass = http::value("pass", "int");
+$retest = http::value("retest", "int");
 $min_days_overdue = http::value("min_days_overdue", "int");
 $custom = http::value("custom");
 
@@ -135,6 +136,15 @@ if($tester_id) $nvp["tester_id"] = $tester_id;
 // Pass
 if(strlen($pass) > 0) $nvp["pass"] = $pass;
 
+if(isset($retest)) {
+	if($retest === 0) {
+		$nvp["retest"] = 0;
+	}
+	if($retest === 1) {
+		$nvp["retest"] = 1;
+	}
+}
+
 $filter_count = count($nvp);
 
 $sort = http::value("sort");
@@ -252,4 +262,4 @@ $sorts = [
 Core::addScript("public/js/app-test-list.js");
 
 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", "location_name", "pass", "min_days_overdue", "custom", "test_id", "tester_id", "filter_count", "status", "status_tester_invoice"));
+View::include("test_list", compact("tests", "pagination_object", "sort", "sorts", "projects", "customers", "customer_id", "project_id", "location_id", "location_internal_id", "location_name", "pass", "retest", "min_days_overdue", "custom", "test_id", "tester_id", "filter_count", "status", "status_tester_invoice"));

+ 28 - 1
views/test_list.php

@@ -11,6 +11,7 @@
  * @var Project[] $projects
  * @var int $project_id
  * @var bool $pass
+ * @var int $retest
  * @var int $test_id
  * @var int $tester_id
  * @var int $location_id
@@ -32,6 +33,12 @@ $result_options = [
 	"0" => "Fail",
 ];
 
+$retest_options = [
+	"" => "Any",
+	"0" => "Tests Only",
+	"1" => "Retests Only"
+];
+
 $custom_filters = [
 	"overdue_project" => "Overdue (Project Deadline)",
 	"overdue_test" => "Overdue (Test Due Date)",
@@ -178,6 +185,16 @@ foreach($projects as $project) {
 									</select>
 								</div>
 							</div>
+							<div class="row mb-1">
+								<label class="col-sm-4 col-form-label" for="retest">Retest</label>
+								<div class="col-sm">
+									<select class="form-control" name="retest" id="retest">
+										<?php
+										HtmlHelper::renderOptions($retest_options, $retest);
+										?>
+									</select>
+								</div>
+							</div>
 						</div>
 						<div class="col-lg">
 							<div class="row mb-1">
@@ -291,7 +308,8 @@ foreach($projects as $project) {
 							<th>P. Costs</th>
 							<th>Status</th>
 							<th>Result</th>
-							<th></th>
+							<th>Retest</th>
+							<th>Actions</th>
 						</tr>
 						</thead>
 						<tbody>
@@ -421,6 +439,15 @@ foreach($projects as $project) {
 										<i class="fas fa-2x fa-fw fa-<?=$test->getPassIcon()?>"></i>
 									</div>
 								</td>
+								<td class="text-center align-middle">
+									<?php
+									if($test->retest) {
+										?>
+										<i class="fa fa-fw fa-check fa-2x text-success"></i>
+										<?php
+									}
+									?>
+								</td>
 								<td class="text-right align-middle">
 									<div class="dropdown">
 										<button class="btn btn-sm btn-secondary dropdown-toggle" type="button" id="test-dropdown-<?=$test->id?>" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">