fix years for categories
This commit is contained in:
parent
9e65a3731c
commit
42067a7b04
@ -118,36 +118,36 @@ class TabulateWinners extends Command
|
|||||||
return $zeroTo43Query->vehicle;
|
return $zeroTo43Query->vehicle;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fortyThreeToSixtyEightWinner()
|
function fortyThreeToSixtySevenWinner()
|
||||||
{
|
{
|
||||||
$fortyThreeToSixtyEightQuery = VehicleScores::join('vehicles', 'vehicle_scores.vehicle', '=', 'vehicles.id')
|
$fortyThreeToSixtySevenQuery = 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', '<=', 1968)
|
->where('vehicles.year', '<=', 1967)
|
||||||
->where('vehicles.doNotJudge', '=', 0)
|
->where('vehicles.doNotJudge', '=', 0)
|
||||||
->orderBy('totalscore','desc')
|
->orderBy('totalscore','desc')
|
||||||
->first();
|
->first();
|
||||||
return $fortyThreeToSixtyEightQuery->vehicle;
|
return $fortyThreeToSixtySevenQuery->vehicle;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sixtyNineToNinetyEightWinner()
|
function sixtyEightToNinetyEightWinner()
|
||||||
{
|
{
|
||||||
$sixtyNineToNinetyEightQuery = VehicleScores::join('vehicles', 'vehicle_scores.vehicle', '=', 'vehicles.id')
|
$sixtyEightToNinetyEightQuery = 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', '>=', 1969)
|
->where('vehicles.year', '>=', 1968)
|
||||||
->where('vehicles.year', '<=', 1998)
|
->where('vehicles.year', '<=', 1998)
|
||||||
->where('vehicles.doNotJudge', '=', 0)
|
->where('vehicles.doNotJudge', '=', 0)
|
||||||
->orderBy('totalscore','desc')
|
->orderBy('totalscore','desc')
|
||||||
->first();
|
->first();
|
||||||
return $sixtyNineToNinetyEightQuery->vehicle;
|
return $sixtyEightToNinetyEightQuery->vehicle;
|
||||||
}
|
}
|
||||||
|
|
||||||
function NinetyNineToCurrentWinner()
|
function NinetyNineToCurrentWinner()
|
||||||
@ -226,7 +226,7 @@ class TabulateWinners extends Command
|
|||||||
'place' => 'first'
|
'place' => 'first'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'vehicle' => fortyThreeToSixtyEightWinner()
|
'vehicle' => fortyThreeToSixtySevenWinner()
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
CarShowWinner::updateOrCreate(
|
CarShowWinner::updateOrCreate(
|
||||||
@ -235,7 +235,7 @@ class TabulateWinners extends Command
|
|||||||
'place' => 'second'
|
'place' => 'second'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'vehicle' => fortyThreeToSixtyEightWinner()
|
'vehicle' => fortyThreeToSixtySevenWinner()
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
CarShowWinner::updateOrCreate(
|
CarShowWinner::updateOrCreate(
|
||||||
@ -244,7 +244,7 @@ class TabulateWinners extends Command
|
|||||||
'place' => 'third'
|
'place' => 'third'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'vehicle' => fortyThreeToSixtyEightWinner()
|
'vehicle' => fortyThreeToSixtySevenWinner()
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ class TabulateWinners extends Command
|
|||||||
'place' => 'first'
|
'place' => 'first'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'vehicle' => sixtyNineToNinetyEightWinner()
|
'vehicle' => sixtyEightToNinetyEightWinner()
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
CarShowWinner::updateOrCreate(
|
CarShowWinner::updateOrCreate(
|
||||||
@ -264,7 +264,7 @@ class TabulateWinners extends Command
|
|||||||
'place' => 'second'
|
'place' => 'second'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'vehicle' => sixtyNineToNinetyEightWinner()
|
'vehicle' => sixtyEightToNinetyEightWinner()
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
CarShowWinner::updateOrCreate(
|
CarShowWinner::updateOrCreate(
|
||||||
@ -273,7 +273,7 @@ class TabulateWinners extends Command
|
|||||||
'place' => 'third'
|
'place' => 'third'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'vehicle' => sixtyNineToNinetyEightWinner()
|
'vehicle' => sixtyEightToNinetyEightWinner()
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user