Procházet zdrojové kódy

Add support to edit Retest flag

Alan Lam před 8 roky
rodič
revize
28d5ffe145
3 změnil soubory, kde provedl 16 přidání a 16 odebrání
  1. 1 1
      controllers/test.php
  2. 4 2
      engine/test.php
  3. 11 13
      views/test_verify_form.php

+ 1 - 1
controllers/test.php

@@ -333,7 +333,7 @@ else if(Core::$user->level >= User::LEVEL_ADMIN) {
 
 			if($form_exception->hasErrors()) throw $form_exception;
 
-			$test->retest |= http::value("retest", "int");
+			$test->retest = http::value("retest", "int");
 
 			$test->dts_updated = Util::getDateTime();
 			$success = $test->commit();

+ 4 - 2
engine/test.php

@@ -366,6 +366,8 @@ class Test extends Model {
 		return $success;
 	}
 
+	public function isPendingVerification() {
+		return $this->status == Test::STATUS_PENDING_VERIFICATION;
+	}
 }
-
-?>
+?>

+ 11 - 13
views/test_verify_form.php

@@ -17,6 +17,7 @@ if(!is_null($test->dts_end)) {
 
 if(in_array($test->status, [Test::STATUS_CANCELLED, Test::STATUS_COMPLETED])) {
 	$test_details["Verified"] = Util::getDisplayDateTime(strtotime($test->dts_verified . " UTC"));
+	$test_details["Retest"] = $test->retest ? "Yes" : "No";
 }
 
 $tester_details = [
@@ -290,6 +291,16 @@ function render_card_list_group($details) {
 							</div>
 						</div>
 
+						<div class="row mb-1">
+							<div class="col-sm-4">Retest</div>
+							<div class="col-sm">
+								<div class="form-check">
+									<input class="form-check-input" type="checkbox" name="retest" id="retest" value="1" <?=Form::checked($test->retest)?> />
+									<label class="form-check-label" for="retest">Retest</label>
+								</div>
+							</div>
+						</div>
+
 						<?php
 						if($test->status == Test::STATUS_PENDING_VERIFICATION) {
 							?>
@@ -341,19 +352,6 @@ function render_card_list_group($details) {
 							}
 							?>
 
-							<div class="row mb-1">
-								<div class="col-sm-4">Retest</div>
-								<div class="col-sm">
-									<div class="form-check">
-										<input class="form-check-input" type="checkbox" name="retest" id="retest" value="1" <?=Form::checked($test->retest)?> />
-										<label class="form-check-label" for="retest">Retest</label>
-									</div>
-									<small class="form-text text-muted">
-										If this test was a retest, please check the box above. Once the test is accepted or rejected, this flag cannot be changed.
-									</small>
-								</div>
-							</div>
-
 							<div class="row mb-1">
 								<label class="col-sm-4 col-form-label" for="tester-message">Message to Tester (if rejecting)</label>
 								<div class="col-sm">