update
This commit is contained in:
@@ -33,32 +33,60 @@ class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, ValidatesRequests;
|
||||
private function cekBatasAtas($value, $rule) {
|
||||
if (!$rule || !str_contains($rule, '>')) return false;
|
||||
if (!$rule) return false;
|
||||
|
||||
// 1. Cek apakah rule mengandung tanda > atau ≥
|
||||
// Kita gunakan array untuk mengecek berbagai kemungkinan simbol
|
||||
$validSymbols = ['>', '≥', '>', '>='];
|
||||
$found = false;
|
||||
foreach ($validSymbols as $symbol) {
|
||||
if (str_contains($rule, $symbol)) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) return false;
|
||||
|
||||
// Ambil angkanya
|
||||
$angka = (int) filter_var($rule, FILTER_SANITIZE_NUMBER_INT);
|
||||
|
||||
return $value > $angka;
|
||||
// 2. Gunakan >= agar angka 17 tetap dianggap 'S' (Sensitive/Suspect)
|
||||
return $value >= $angka;
|
||||
}
|
||||
private function cekMidRange($value, $rule) {
|
||||
if (!$rule) return false;
|
||||
$rule = trim($rule);
|
||||
|
||||
if ($rule === '-' || $rule === '') return false;
|
||||
|
||||
if (!str_contains($rule, '-')) return false;
|
||||
|
||||
[$min, $max] = array_map('trim', explode('-', $rule));
|
||||
|
||||
if (!is_numeric($min) || !is_numeric($max)) return false;
|
||||
|
||||
// Midrange biasanya sudah benar, tapi pastikan casting int/float sesuai kebutuhan
|
||||
return $value >= (int)$min && $value <= (int)$max;
|
||||
}
|
||||
private function cekBatasBawah($value, $rule) {
|
||||
if (!$rule || !str_contains($rule, '<')) return false;
|
||||
if (!$rule) return false;
|
||||
|
||||
// 1. Cek apakah rule mengandung tanda < atau ≤
|
||||
$validSymbols = ['<', '≤', '<', '<='];
|
||||
$found = false;
|
||||
foreach ($validSymbols as $symbol) {
|
||||
if (str_contains($rule, $symbol)) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$found) return false;
|
||||
|
||||
$angka = (int) filter_var($rule, FILTER_SANITIZE_NUMBER_INT);
|
||||
|
||||
return $value < $angka;
|
||||
// 2. Gunakan <= agar angka 13 tetap dianggap 'R' (Resistant)
|
||||
return $value <= $angka;
|
||||
}
|
||||
protected function cekInterpretasi($value, $data) {
|
||||
if ($this->cekBatasAtas($value, $data->batasatas)) {
|
||||
@@ -72,7 +100,6 @@ class Controller extends BaseController
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function getStyledValue($value, $color, $strong = false) {
|
||||
return $strong ? "<strong><font color=\"$color\">$value</font></strong>" : "<font color=\"$color\">$value</font>";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user