Fix tabulations

This commit is contained in:
Russ Long 2022-05-01 09:44:49 -04:00
parent a9c8a7bda5
commit 583eb1f2f3

View File

@ -88,6 +88,20 @@ class TabulateWinners extends Command
return $peoplesChoiceWinnerQuery->vehicle; return $peoplesChoiceWinnerQuery->vehicle;
} }
function pc2ndWinner()
{
$peoplesChoice2ndWinnerQuery = PeoplesChoice::join('vehicles', 'peoples_choice.vehicle', '=', 'vehicles.id')
->groupBy('peoples_choice.vehicle')
->selectRaw('*, sum(pc_count) as totalscore')
->whereNotIn('vehicle', function($query){
$query->select('vehicle')->from('car_show_winners');
})
->where('vehicles.doNotJudge', '=', 0)
->orderBy('totalscore','desc')
->first();
return $peoplesChoice2ndWinnerQuery->vehicle;
}
function zeroTo43Winner() function zeroTo43Winner()
{ {
$zeroTo43Query = VehicleScores::join('vehicles', 'vehicle_scores.vehicle', '=', 'vehicles.id') $zeroTo43Query = VehicleScores::join('vehicles', 'vehicle_scores.vehicle', '=', 'vehicles.id')
@ -104,6 +118,22 @@ class TabulateWinners extends Command
return $zeroTo43Query->vehicle; return $zeroTo43Query->vehicle;
} }
function zeroTo432ndWinner()
{
$zeroTo432ndQuery = 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.year', '>=', 0)
->where('vehicles.year', '<=', 1943)
->where('vehicles.doNotJudge', '=', 0)
->orderBy('totalscore','desc')
->first();
return $zeroTo432ndQuery->vehicle;
}
function fortyFourToCurrentWinner() function fortyFourToCurrentWinner()
{ {
$fortyFourToCurrentQuery = VehicleScores::join('vehicles', 'vehicle_scores.vehicle', '=', 'vehicles.id') $fortyFourToCurrentQuery = VehicleScores::join('vehicles', 'vehicle_scores.vehicle', '=', 'vehicles.id')
@ -120,6 +150,22 @@ class TabulateWinners extends Command
return $fortyFourToCurrentQuery->vehicle; return $fortyFourToCurrentQuery->vehicle;
} }
function fortyFourToCurrent2ndWinner()
{
$fortyFourToCurrent2ndQuery = 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.year', '>=', 1944)
//->where('vehicles.year', '<=', 1959)
->where('vehicles.doNotJudge', '=', 0)
->orderBy('totalscore','desc')
->first();
return $fortyFourToCurrent2ndQuery->vehicle;
}
//categories //categories
/* Here for reference only /* Here for reference only
$individuallyProcessedAwards = array( $individuallyProcessedAwards = array(
@ -177,7 +223,7 @@ class TabulateWinners extends Command
'place' => 'second' 'place' => 'second'
], ],
[ [
'vehicle' => pcWinner() 'vehicle' => pc2ndWinner()
] ]
); );
//Insert Year Award Winners //Insert Year Award Winners
@ -198,7 +244,7 @@ class TabulateWinners extends Command
'place' => 'second' 'place' => 'second'
], ],
[ [
'vehicle' => zeroTo43Winner() 'vehicle' => zeroTo432ndWinner()
] ]
); );
//1944-Current //1944-Current
@ -218,7 +264,7 @@ class TabulateWinners extends Command
'place' => 'second' 'place' => 'second'
], ],
[ [
'vehicle' => fortyFourToCurrentWinner() 'vehicle' => fortyFourToCurrent2ndWinner()
] ]
); );
} }