Fixes the configuration file
This commit is contained in:
@@ -103,15 +103,17 @@ private function calculateAndUpdateScore(Screening $screening, array $answers):
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the total score from the answers.
|
||||
* Calculate the total score from the answers — yes = 1, unknown = 0.5, no = 0.
|
||||
*/
|
||||
private function calculateScore(array $answers): int
|
||||
private function calculateScore(array $answers): float
|
||||
{
|
||||
$score = 0;
|
||||
|
||||
foreach ($answers as $value) {
|
||||
if ($value === 'yes') {
|
||||
$score++;
|
||||
} elseif ($value === 'unknown') {
|
||||
$score += 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public function rules(): array
|
||||
{
|
||||
return [
|
||||
'answers' => ['required', 'array', 'size:10'],
|
||||
'answers.*' => ['required', 'string', 'in:yes,no'],
|
||||
'answers.*' => ['required', 'string', 'in:yes,unknown,no'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public function messages(): array
|
||||
'answers.size' => 'All 10 screening questions must be answered.',
|
||||
'answers.*.required' => 'Each screening question must have an answer.',
|
||||
'answers.*.string' => 'Each answer must be a valid text value.',
|
||||
'answers.*.in' => 'Each answer must be either "yes" or "no".',
|
||||
'answers.*.in' => 'Each answer must be "yes", "I don\'t know", or "no".',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user