|
@@ -4,7 +4,7 @@ class Test extends Model {
|
|
|
|
|
|
|
|
protected static $table = "test";
|
|
protected static $table = "test";
|
|
|
protected static $id_field = "id";
|
|
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"];
|
|
const TEST_FIELDS = ["shop_left", "shop_right", "attire", "challenge_stage", "challenge_description", "challenger_name", "challenger_description", "challenger_gender", "challenger_eye_contact", "additional_notes"];
|
|
|
|
|
|
|
@@ -46,6 +46,7 @@ class Test extends Model {
|
|
|
|
|
|
|
|
$tester = $this->getTester();
|
|
$tester = $this->getTester();
|
|
|
$location = $this->getLocation();
|
|
$location = $this->getLocation();
|
|
|
|
|
+ $project = $this->getProject();
|
|
|
|
|
|
|
|
// Content
|
|
// Content
|
|
|
$name = htmlspecialchars($tester->first_name);
|
|
$name = htmlspecialchars($tester->first_name);
|
|
@@ -60,9 +61,15 @@ class Test extends Model {
|
|
|
$builder = new EmailBuilder;
|
|
$builder = new EmailBuilder;
|
|
|
$builder->addParagraph("<b>Hi $name,</b>");
|
|
$builder->addParagraph("<b>Hi $name,</b>");
|
|
|
$builder->addLeadParagraph("Congrats, you have been allocated a test!");
|
|
$builder->addLeadParagraph("Congrats, you have been allocated a test!");
|
|
|
|
|
+
|
|
|
|
|
+ if($project->isNighttime()) {
|
|
|
|
|
+ $builder->addParagraph("<b><font color=\"red\">Evening Test to be done between 7PM and midnight.</font></b>");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if($message) {
|
|
if($message) {
|
|
|
$builder->addParagraph($message);
|
|
$builder->addParagraph($message);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
$builder->addParagraph("We need you to confirm if you are able to do the test. Please check the details below and then confirm by pressing the <b>Accept</b> or <b>Decline</b> buttons and once you tap <b>Accept</b>, the test will be allocated to you.");
|
|
$builder->addParagraph("We need you to confirm if you are able to do the test. Please check the details below and then confirm by pressing the <b>Accept</b> or <b>Decline</b> buttons and once you tap <b>Accept</b>, the test will be allocated to you.");
|
|
|
$builder->addAcceptDeclineButtons($base_url);
|
|
$builder->addAcceptDeclineButtons($base_url);
|
|
|
$builder->addParagraph("The site address is: <b>$address</b>");
|
|
$builder->addParagraph("The site address is: <b>$address</b>");
|
|
@@ -86,6 +93,7 @@ class Test extends Model {
|
|
|
|
|
|
|
|
$tester = $this->getTester();
|
|
$tester = $this->getTester();
|
|
|
$location = $this->getLocation();
|
|
$location = $this->getLocation();
|
|
|
|
|
+ $project = $this->getProject();
|
|
|
|
|
|
|
|
// Content
|
|
// Content
|
|
|
$name = htmlspecialchars($tester->first_name);
|
|
$name = htmlspecialchars($tester->first_name);
|
|
@@ -96,6 +104,11 @@ class Test extends Model {
|
|
|
$builder = new EmailBuilder;
|
|
$builder = new EmailBuilder;
|
|
|
$builder->addParagraph("<b>Hi $name,</b>");
|
|
$builder->addParagraph("<b>Hi $name,</b>");
|
|
|
$builder->addLeadParagraph("Congrats, you have claimed a test!");
|
|
$builder->addLeadParagraph("Congrats, you have claimed a test!");
|
|
|
|
|
+
|
|
|
|
|
+ if($project->isNighttime()) {
|
|
|
|
|
+ $builder->addParagraph("<b><font color=\"red\">Evening Test to be done between 7PM and midnight.</font></b>");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$builder->addParagraph("The site address is: <b>$address</b>");
|
|
$builder->addParagraph("The site address is: <b>$address</b>");
|
|
|
$builder->addParagraph("The date that need to complete and submit the results by is: <font color=\"red\"><b>$date_due</b></font>");
|
|
$builder->addParagraph("The date that need to complete and submit the results by is: <font color=\"red\"><b>$date_due</b></font>");
|
|
|
$builder->addParagraph("For methodology and further notes please check the <b>Useful Documents</b> section on the <b>Account</b> page.");
|
|
$builder->addParagraph("For methodology and further notes please check the <b>Useful Documents</b> section on the <b>Account</b> page.");
|
|
@@ -326,6 +339,33 @@ 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;
|
|
|
|
|
+ $this->dts_due = null;
|
|
|
|
|
+ $this->dts_assigned = null;
|
|
|
|
|
+ $success = $this->commit();
|
|
|
|
|
+
|
|
|
|
|
+ return $success;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
?>
|