Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions app/Livewire/Planning/QualityAssessment/QuestionRanges.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ public function updateMin($index, $value)
public function updateMax($index, $value)
{
try {
// Validar se o valor é um número válido
if (!is_numeric($value)) {
throw new \Exception(__('project/planning.quality-assessment.ranges.invalid-number'));
}

/**
* If the new "end" value is the same as the current "end" value,
* do nothing
Expand All @@ -88,8 +93,8 @@ public function updateMax($index, $value)
return;
}

$this->items[$index]['end'] = round($value, 2);
$this->items[$index + 1]['start'] = round($value + 0.01, 2);
$this->items[$index]['end'] = round((float)$value, 2);
$this->items[$index + 1]['start'] = round((float)$value + 0.01, 2);

/**
* Update the current "end" value
Expand All @@ -110,7 +115,7 @@ public function updateMax($index, $value)
GeneralScore::updateOrCreate([
'id_general_score' => $this->items[$index + 1]['id_general_score']
], [
'start' => round($value + 0.01, 2),
'start' => round((float)$value + 0.01, 2),
]);

$this->dispatch('general-scores-generated');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
max="{{ $sum }}"
disabled="{{ !$loop->first }}"
style="min-width: 150px"
x-on:keydown="['e', 'E', '+', '-'].includes($event.key) && $event.preventDefault()"
/>
<x-input
label="Max"
Expand All @@ -30,6 +31,7 @@
max="{{ $sum }}"
style="min-width: 150px"
disabled="{{ $loop->last }}"
x-on:keydown="['e', 'E', '+', '-'].includes($event.key) && $event.preventDefault()"
/>
<div class="btn-group">
<x-input
Expand Down