|
|
@@ -18,6 +18,7 @@ if($test->dts_start && $test->dts_end) {
|
|
|
|
|
|
$line_of_sight = (bool) ($values["play_machine_line_of_sight"] ?? false);
|
|
|
$play_minutes = (int) ($values["play_minutes"] ?? 0);
|
|
|
+ $challenge_stage = (int) $test->challenge_stage;
|
|
|
|
|
|
// Calculate minimum duration
|
|
|
$min_duration = 0;
|
|
|
@@ -33,6 +34,10 @@ if($test->dts_start && $test->dts_end) {
|
|
|
|
|
|
$min_duration += $play_minutes;
|
|
|
|
|
|
+ if(in_array($challenge_stage, [4, 5]) && $play_minutes < 3) {
|
|
|
+ $form_exception->addError("Please confirm that you played for at least 3 minutes because you have selected After Play / No Challenge.");
|
|
|
+ }
|
|
|
+
|
|
|
if($duration < $min_duration) {
|
|
|
$form_exception->addError("Please check the entry and exit times. Based on the information you have given, the minimum test duration is $min_duration minute(s).");
|
|
|
}
|
|
|
@@ -43,13 +48,19 @@ if($test->dts_start && $test->dts_end) {
|
|
|
$form_exception->addError("Bar arrival time must be filled in if you were not challenged.");
|
|
|
}
|
|
|
else {
|
|
|
+ $dt_bar_min = $dt_start->addMinutes($min_duration);
|
|
|
$dt_bar = CarbonImmutable::instance($dt_start)->setTimeFromTimeString($bar_time);
|
|
|
|
|
|
$start_time = $dt_start->format("H:i");
|
|
|
$end_time = $dt_end->format("H:i");
|
|
|
+ $min_bar_time = $dt_bar_min->format("H:i");
|
|
|
+
|
|
|
+ if($dt_bar < $dt_bar_min) {
|
|
|
+ $form_exception->addError("Bar arrival time needs to be $min_bar_time or after.");
|
|
|
+ }
|
|
|
|
|
|
- if($dt_bar < $dt_start || $dt_bar > $dt_end) {
|
|
|
- $form_exception->addError("Bar arrival time must be between $start_time and $end_time.");
|
|
|
+ if($dt_bar < $dt_bar_min || $dt_bar > $dt_end) {
|
|
|
+ $form_exception->addError("Bar arrival time must be between $min_bar_time and $end_time.");
|
|
|
}
|
|
|
}
|
|
|
}
|