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

Added dts_updated field for test.

Alan Lam 8 лет назад
Родитель
Сommit
41a15c07c8

+ 2 - 1
controllers/project_ajax.php

@@ -113,7 +113,7 @@ if($submit) {
 				*/
 
 				$max_distance = 25;
-				
+
 				if(Core::$user->level == User::LEVEL_SUPERADMIN) {
 					$max_distance = 1000;
 				}
@@ -257,6 +257,7 @@ if($submit) {
 				$test->status = Test::STATUS_ASSIGNED;
 				$test->tester_id = $user->id;
 				$test->dts_assigned = Util::getDateTime();
+				$test->dts_updated = Util::getDateTime();
 
 				if($unix_due) {
 					$test->dts_due = "$year-$month-$day 23:59:59";

+ 1 - 0
controllers/project_edit.php

@@ -100,6 +100,7 @@ if($submit) {
 			]);
 			if($test) {
 				$test->status = Test::STATUS_CANCELLED;
+				$test->dts_updated = Util::getDateTime();
 				$test->commit();
 			}
 		}

+ 3 - 0
controllers/test.php

@@ -134,6 +134,7 @@ if(Core::$user->level == User::LEVEL_TESTER) {
 			if($test->status == Test::STATUS_CONFIRMED) {
 				$test->status = Test::STATUS_STARTED;
 				$test->dts_start = Util::getDateTime();
+				$test->dts_updated = Util::getDateTime();
 				$success = $test->commit();
 				if(!$success) throw new Exception("Failed to save test. Please try again later.");
 
@@ -151,6 +152,7 @@ if(Core::$user->level == User::LEVEL_TESTER) {
 				$test->dts_end = date("Y-m-d H:i:s", $unix_end);
 
 				$test->pass = ($test->challenge_stage <= 2) ? 1 : 0; // Pass = Challenged during browsing or before
+				$test->dts_updated = Util::getDateTime();
 
 				$success = $test->commit();
 				if(!$success) throw new Exception("Failed to save test. Please try again later.");
@@ -278,6 +280,7 @@ else if(Core::$user->level >= User::LEVEL_ADMIN) {
 
 			if($form_exception->hasErrors()) throw $form_exception;
 
+			$test->dts_updated = Util::getDateTime();
 			$success = $test->commit();
 			if(!$success) throw new Exception("Failed to update the test. Please try again later.");
 

+ 2 - 0
controllers/test_confirm.php

@@ -9,6 +9,7 @@ switch($action) {
 	case "accept":
 
 		$test->status = Test::STATUS_CONFIRMED;
+		$test->dts_updated = Util::getDateTime();
 		$test->commit();
 
 		// TODO: Email/notification?
@@ -23,6 +24,7 @@ switch($action) {
 		$test->tester_id = null;
 		$test->dts_due = null;
 		$test->dts_assigned = null;
+		$test->dts_updated = Util::getDateTime();
 		$test->commit();
 
 		// TODO: Email/notification?

+ 1 - 1
engine/test.php

@@ -4,7 +4,7 @@ class Test extends Model {
 
 	protected static $table = "test";
 	protected static $id_field = "id";
-	protected static $fillable_fields = ["project_id", "location_id", "tester_id", "status", "test_fee", "test_time", "shop_left", "shop_right", "attire", "challenge_stage", "challenge_description", "challenger_name", "challenger_description", "challenger_gender", "challenger_eye_contact", "additional_notes", "dts_due", "dts_start", "dts_end", "verifier_id", "verifier_notes", "pass", "dts_created", "dts_assigned", "dts_verified"];
+	protected static $fillable_fields = ["project_id", "location_id", "tester_id", "status", "test_fee", "test_time", "shop_left", "shop_right", "attire", "challenge_stage", "challenge_description", "challenger_name", "challenger_description", "challenger_gender", "challenger_eye_contact", "additional_notes", "dts_due", "dts_start", "dts_end", "verifier_id", "verifier_notes", "pass", "dts_created", "dts_updated", "dts_assigned", "dts_verified"];
 
 	protected static $field_map = [
 	];

+ 2 - 2
views/test_verify_form.php

@@ -94,8 +94,8 @@ function render_card_list_group($details) {
 
 							?>
 							<div class="row mb-1">
-								<label class="col-sm-4 col-form-label"><?=htmlspecialchars($field->label)?></label>
-								<div class="col-sm-8">
+								<label class="col-sm-8 col-form-label"><?=htmlspecialchars($field->label)?></label>
+								<div class="col-sm-4">
 									<a href="/account/tests/<?=$test->id?>/files/<?=$field->name?>" target="_blank">
 										<img class="img-fluid rounded" src="/account/tests/<?=$test->id?>/files/<?=$field->name?>" alt="<?=htmlspecialchars($field->label)?>" />
 									</a>