Fix tabulations
This commit is contained in:
parent
a9c8a7bda5
commit
583eb1f2f3
@ -88,6 +88,20 @@ class TabulateWinners extends Command
|
||||
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()
|
||||
{
|
||||
$zeroTo43Query = VehicleScores::join('vehicles', 'vehicle_scores.vehicle', '=', 'vehicles.id')
|
||||
@ -104,6 +118,22 @@ class TabulateWinners extends Command
|
||||
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()
|
||||
{
|
||||
$fortyFourToCurrentQuery = VehicleScores::join('vehicles', 'vehicle_scores.vehicle', '=', 'vehicles.id')
|
||||
@ -120,6 +150,22 @@ class TabulateWinners extends Command
|
||||
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
|
||||
/* Here for reference only
|
||||
$individuallyProcessedAwards = array(
|
||||
@ -177,7 +223,7 @@ class TabulateWinners extends Command
|
||||
'place' => 'second'
|
||||
],
|
||||
[
|
||||
'vehicle' => pcWinner()
|
||||
'vehicle' => pc2ndWinner()
|
||||
]
|
||||
);
|
||||
//Insert Year Award Winners
|
||||
@ -198,7 +244,7 @@ class TabulateWinners extends Command
|
||||
'place' => 'second'
|
||||
],
|
||||
[
|
||||
'vehicle' => zeroTo43Winner()
|
||||
'vehicle' => zeroTo432ndWinner()
|
||||
]
|
||||
);
|
||||
//1944-Current
|
||||
@ -218,7 +264,7 @@ class TabulateWinners extends Command
|
||||
'place' => 'second'
|
||||
],
|
||||
[
|
||||
'vehicle' => fortyFourToCurrentWinner()
|
||||
'vehicle' => fortyFourToCurrent2ndWinner()
|
||||
]
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user