Skip to content
Snippets Groups Projects
Commit 3feb9990 authored by Jonathan Foucher's avatar Jonathan Foucher
Browse files

put division back

parent 40d6e4bd
No related branches found
No related tags found
No related merge requests found
Pipeline #31878 failed
......@@ -210,16 +210,16 @@ public function getBestMeasuresForEvaluation(Evaluation $evaluation): array
$bestMeasures = array_map(function ($i) {return 0; }, array_flip($measures->pluck('id')->toArray()));
// $res = DB::select('select measures.id, count(*) as qty from measures
//-- join measure_scenario on measures.id=measure_scenario.measure_id
//-- join danger_scenario on danger_scenario.scenario_id=measure_scenario.scenario_id
//group by measures.id');
$res = DB::select('select measures.id, count(*) as qty from measures
join measure_scenario on measures.id=measure_scenario.measure_id
join danger_scenario on danger_scenario.scenario_id=measure_scenario.scenario_id
group by measures.id');
$measureCount = [];
// foreach ($res as $row) {
// $measureCount[$row->id] = $row->qty;
// }
foreach ($res as $row) {
$measureCount[$row->id] = $row->qty;
}
/**
* @var DangerLevelEvaluation $dangerLevel
......@@ -270,7 +270,7 @@ public function getBestMeasuresForEvaluation(Evaluation $evaluation): array
// est pondérée par la perception du danger
// puis ajouté au score pour cette mesure
$ponderatedIncrement = ($l2 - $l1) * $dangerLevel->level->value;// / $measureCount[$measure->id];
$ponderatedIncrement = ($l2 - $l1) * $dangerLevel->level->value / $measureCount[$measure->id];
$bestMeasures[$measure->id] += $ponderatedIncrement;
Log::info('Incrément pondéré : ' . $ponderatedIncrement);
Log::info('Valeur courante de la mesure ' . $measure->id . ' (' . $measure->short_name . ') : ' . $bestMeasures[$measure->id]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment