This commit is contained in:
Russ Long 2024-05-08 19:09:44 -04:00
parent 141d6c25fa
commit 4bdf14de83

View File

@ -118,20 +118,20 @@ class TabulateWinners extends Command
return $zeroTo43Query->vehicle; return $zeroTo43Query->vehicle;
} }
function fortyThreeToSixtySevenWinner() function fortyThreeToSixtyEightWinner()
{ {
$fortyThreeToSixtySevenQuery = VehicleScores::join('vehicles', 'vehicle_scores.vehicle', '=', 'vehicles.id') $fortyThreeToSixtyEightQuery = VehicleScores::join('vehicles', 'vehicle_scores.vehicle', '=', 'vehicles.id')
->groupBy('vehicles.id') ->groupBy('vehicles.id')
->selectRaw('*, sum(vehicle_scores.overall_score) as totalscore') ->selectRaw('*, sum(vehicle_scores.overall_score) as totalscore')
->whereNotIn('vehicle_scores.vehicle', function($query){ ->whereNotIn('vehicle_scores.vehicle', function($query){
$query->select('vehicle')->from('car_show_winners'); $query->select('vehicle')->from('car_show_winners');
}) })
->where('vehicles.year', '>=', 1943) ->where('vehicles.year', '>=', 1943)
->where('vehicles.year', '<=', 1967) ->where('vehicles.year', '<=', 1968)
->where('vehicles.doNotJudge', '=', 0) ->where('vehicles.doNotJudge', '=', 0)
->orderBy('totalscore','desc') ->orderBy('totalscore','desc')
->first(); ->first();
return $fortyThreeToSixtySevenQuery->vehicle; return $fortyThreeToSixtyEightQuery->vehicle;
} }
function sixtyEightToNinetyEightWinner() function sixtyEightToNinetyEightWinner()
@ -226,7 +226,7 @@ class TabulateWinners extends Command
'place' => 'first' 'place' => 'first'
], ],
[ [
'vehicle' => fortyThreeToSixtySevenWinner() 'vehicle' => fortyThreeToSixtyEightWinner()
] ]
); );
CarShowWinner::updateOrCreate( CarShowWinner::updateOrCreate(
@ -235,7 +235,7 @@ class TabulateWinners extends Command
'place' => 'second' 'place' => 'second'
], ],
[ [
'vehicle' => fortyThreeToSixtySevenWinner() 'vehicle' => fortyThreeToSixtyEightWinner()
] ]
); );
CarShowWinner::updateOrCreate( CarShowWinner::updateOrCreate(
@ -244,7 +244,7 @@ class TabulateWinners extends Command
'place' => 'third' 'place' => 'third'
], ],
[ [
'vehicle' => fortyThreeToSixtySevenWinner() 'vehicle' => fortyThreeToSixtyEightWinner()
] ]
); );