try to fix winner tabulation

This commit is contained in:
Russ Long 2022-05-01 09:42:47 -04:00
parent 0a231c14bb
commit a9c8a7bda5

View File

@ -60,6 +60,20 @@ class TabulateWinners extends Command
return $bestInShowWinnerQuery->vehicle;
}
function bestInShow2ndWinner()
{
$bestInShow2ndWinnerQuery = VehicleScores::join('vehicles', 'vehicle_scores.vehicle', '=', 'vehicles.id')
->groupBy('vehicles.id')
->selectRaw('*, sum(vehicle_scores.overall_score) as totalscore')
->whereNotIn('vehicle_scores.vehicle', function($query){
$query->select('vehicle')->from('car_show_winners');
})
->where('vehicles.doNotJudge', '=', 0)
->orderBy('totalscore','desc')
->first();
return $bestInShow2ndWinnerQuery->vehicle;
}
function pcWinner()
{
$peoplesChoiceWinnerQuery = PeoplesChoice::join('vehicles', 'peoples_choice.vehicle', '=', 'vehicles.id')
@ -142,7 +156,7 @@ class TabulateWinners extends Command
'place' => 'second'
],
[
'vehicle' => bestInShowWinner()
'vehicle' => bestInShow2ndWinner()
]
);