|
|
@@ -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", "test_travel_cost", "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 $fillable_fields = ["project_id", "location_id", "tester_id", "status", "test_fee", "test_time", "test_travel_cost", "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", "retest", "dts_created", "dts_updated", "dts_assigned", "dts_verified"];
|
|
|
|
|
|
const TEST_FIELDS = ["shop_left", "shop_right", "attire", "challenge_stage", "challenge_description", "challenger_name", "challenger_description", "challenger_gender", "challenger_eye_contact", "additional_notes"];
|
|
|
|
|
|
@@ -339,6 +339,23 @@ class Test extends Model {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public function getPreviousTest() {
|
|
|
+
|
|
|
+ $nvp = [
|
|
|
+ "dts_start" => (new Constraint("LESS_THAN"))->setValues($this->dts_start),
|
|
|
+ "location_id" => $this->location_id,
|
|
|
+ "status" => Test::STATUS_COMPLETED,
|
|
|
+ ];
|
|
|
+
|
|
|
+ $tests = Test::query($nvp, [
|
|
|
+ "sort" => "dts_start",
|
|
|
+ "order" => "desc",
|
|
|
+ ]);
|
|
|
+
|
|
|
+ return $tests ? $tests[0] : false;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
public function unassignTester() {
|
|
|
$this->status = Test::STATUS_UNASSIGNED;
|
|
|
$this->tester_id = null;
|