fix(assessment-form): clean code

This commit is contained in:
arieeefajar 2025-06-03 22:48:51 +07:00
parent 24762fa3aa
commit 4459a1ea16
1 changed files with 0 additions and 13 deletions

View File

@ -6,9 +6,7 @@
use App\Models\EvaluationDetail;
use App\Models\Indicator;
use App\Models\Land;
use App\Models\Rule;
use App\Models\RuleExpert;
use Dotenv\Parser\Value;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
@ -57,25 +55,14 @@ public function store(Request $request)
return redirect()->back();
}
// $cf_h = collect(Rule::whereIn('indicator_id', array_keys($cf_e))
// ->orderByDesc('cf')
// ->get()
// ->unique('indicator_id')
// ->pluck('cf', 'indicator_id')
// ->sortKeys());
$cf_h = RuleExpert::get()->keyBy('indicator_id')->pluck('cf', 'indicator_id')->toArray();
$cf_he = collect($cf_e)->map(function ($value, $key) use ($cf_h) {
return [
"cf(h,e)" . $key => (float) $value * (float) ($cf_h[$key] ?? 1)
];
})->collapse()->toArray();
// $cf_he_array = $cf_he->toArray();
// $cf_he_array = collect($cf_he)->sortKeys()->values()->toArray();
$cf_combined = array_shift($cf_he);
foreach ($cf_he as $cf) {