fix(assessment-form): clean code
This commit is contained in:
parent
24762fa3aa
commit
4459a1ea16
|
@ -6,9 +6,7 @@
|
||||||
use App\Models\EvaluationDetail;
|
use App\Models\EvaluationDetail;
|
||||||
use App\Models\Indicator;
|
use App\Models\Indicator;
|
||||||
use App\Models\Land;
|
use App\Models\Land;
|
||||||
use App\Models\Rule;
|
|
||||||
use App\Models\RuleExpert;
|
use App\Models\RuleExpert;
|
||||||
use Dotenv\Parser\Value;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
@ -57,25 +55,14 @@ public function store(Request $request)
|
||||||
return redirect()->back();
|
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_h = RuleExpert::get()->keyBy('indicator_id')->pluck('cf', 'indicator_id')->toArray();
|
||||||
|
|
||||||
|
|
||||||
$cf_he = collect($cf_e)->map(function ($value, $key) use ($cf_h) {
|
$cf_he = collect($cf_e)->map(function ($value, $key) use ($cf_h) {
|
||||||
return [
|
return [
|
||||||
"cf(h,e)" . $key => (float) $value * (float) ($cf_h[$key] ?? 1)
|
"cf(h,e)" . $key => (float) $value * (float) ($cf_h[$key] ?? 1)
|
||||||
];
|
];
|
||||||
})->collapse()->toArray();
|
})->collapse()->toArray();
|
||||||
|
|
||||||
// $cf_he_array = $cf_he->toArray();
|
|
||||||
// $cf_he_array = collect($cf_he)->sortKeys()->values()->toArray();
|
|
||||||
|
|
||||||
$cf_combined = array_shift($cf_he);
|
$cf_combined = array_shift($cf_he);
|
||||||
|
|
||||||
foreach ($cf_he as $cf) {
|
foreach ($cf_he as $cf) {
|
||||||
|
|
Loading…
Reference in New Issue