update skoring

This commit is contained in:
2026-07-09 17:30:19 +07:00
parent 6c95c462cb
commit 3464a802e2
5 changed files with 62 additions and 38 deletions
+5 -5
View File
@@ -163,7 +163,7 @@ class Petani extends Model
return null;
}
return round($nilai->sum(fn ($value) => (int) $value) * 0.1, 1);
return round($nilai->sum(fn ($value) => (int) $value) * 0.2, 1);
}
public function skorPendidikan(): ?float
@@ -242,10 +242,10 @@ class Petani extends Model
return null;
}
$nilai = collect([
$aksesPasar->skor_pengalaman,
$aksesPasar->skor_kesadaran_premium,
])->filter(fn ($value) => !is_null($value) && $value !== '');
$nilai = collect(Schema::getColumnListing($aksesPasar->getTable()))
->filter(fn ($field) => str_starts_with($field, 'skor_'))
->map(fn ($field) => $aksesPasar->getAttribute($field))
->filter(fn ($value) => !is_null($value) && $value !== '');
if ($nilai->isEmpty()) {
return null;