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

@ -58,7 +58,21 @@ class TabulateWinners extends Command
->orderBy('totalscore','desc') ->orderBy('totalscore','desc')
->first(); ->first();
return $bestInShowWinnerQuery->vehicle; 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() function pcWinner()
{ {
@ -142,7 +156,7 @@ class TabulateWinners extends Command
'place' => 'second' 'place' => 'second'
], ],
[ [
'vehicle' => bestInShowWinner() 'vehicle' => bestInShow2ndWinner()
] ]
); );