|
|
@@ -122,8 +122,6 @@ if($submit) {
|
|
|
"status" => Test::STATUS_ASSIGNED,
|
|
|
]);
|
|
|
|
|
|
- $age_constraint = false;
|
|
|
-
|
|
|
usort($addresses, function($a, $b) use ($location) {
|
|
|
$lat_lng = $location->getGeolocation();
|
|
|
return Geolocation::getDistance($lat_lng, $a->getGeolocation()) <=> Geolocation::getDistance($lat_lng, $b->getGeolocation());
|
|
|
@@ -135,6 +133,11 @@ if($submit) {
|
|
|
$user = $address->getUser();
|
|
|
|
|
|
$is_current_tester = $user->id == $test->tester_id;
|
|
|
+ $is_deactivated = $user->level == User::LEVEL_DEACTIVATED;
|
|
|
+ $is_registered = $user->level == User::LEVEL_REGISTERED;
|
|
|
+ $is_unverified = $user->level == User::LEVEL_UNVERIFIED;
|
|
|
+
|
|
|
+ if($is_deactivated) continue;
|
|
|
|
|
|
$distance_miles = Geolocation::getDistance($location->getGeolocation(), $address->getGeolocation());
|
|
|
$distance_kilometers = $distance_miles * Geolocation::KMS_IN_MILE;
|
|
|
@@ -174,7 +177,11 @@ if($submit) {
|
|
|
"latitude" => (float) $address->latitude,
|
|
|
"longitude" => (float) $address->longitude,
|
|
|
"pendingTestCount" => $pending_test_count,
|
|
|
- "isCurrentTester" => $is_current_tester
|
|
|
+ "isCurrentTester" => $is_current_tester,
|
|
|
+ "isRegistered" => $is_registered,
|
|
|
+ "isUnverified" => $is_unverified,
|
|
|
+ "levelText" => $user->getLevelText(),
|
|
|
+ "levelClass" => $user->getLevelClass(),
|
|
|
];
|
|
|
|
|
|
}
|
|
|
@@ -208,6 +215,7 @@ if($submit) {
|
|
|
if(!$address) throw new Exception("User address cannot be found.");
|
|
|
|
|
|
$user = $address->getUser();
|
|
|
+ if($user->level == User::LEVEL_BANNED) throw new Exception("A test cannot be assigned to an banned user.");
|
|
|
if($user->level == User::LEVEL_UNVERIFIED) throw new Exception("A test cannot be assigned to an unverified user.");
|
|
|
if($user->level == User::LEVEL_DEACTIVATED) throw new Exception("A test cannot be assigned to a deactivated user.");
|
|
|
if($user->level >= User::LEVEL_VENUE) throw new Exception("A test cannot be assigned to a user that's not a tester.");
|