adjust year categories
This commit is contained in:
parent
11ef29d89c
commit
141d6c25fa
@ -134,36 +134,36 @@ class TabulateWinners extends Command
|
|||||||
return $fortyThreeToSixtySevenQuery->vehicle;
|
return $fortyThreeToSixtySevenQuery->vehicle;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sixtyEightToNinetySevenWinner()
|
function sixtyEightToNinetyEightWinner()
|
||||||
{
|
{
|
||||||
$sixtyEightToNinetySevenQuery = 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', '>=', 1968)
|
->where('vehicles.year', '>=', 1969)
|
||||||
->where('vehicles.year', '<=', 1997)
|
->where('vehicles.year', '<=', 1998)
|
||||||
->where('vehicles.doNotJudge', '=', 0)
|
->where('vehicles.doNotJudge', '=', 0)
|
||||||
->orderBy('totalscore','desc')
|
->orderBy('totalscore','desc')
|
||||||
->first();
|
->first();
|
||||||
return $sixtyEightToNinetySevenQuery->vehicle;
|
return $sixtyEightToNinetyEightQuery->vehicle;
|
||||||
}
|
}
|
||||||
|
|
||||||
function NinetyEightToCurrentWinner()
|
function NinetyNineToCurrentWinner()
|
||||||
{
|
{
|
||||||
$NinetyEightToCurrentQuery = VehicleScores::join('vehicles', 'vehicle_scores.vehicle', '=', 'vehicles.id')
|
$NinetyNineToCurrentQuery = 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', '>=', 1998)
|
->where('vehicles.year', '>=', 1999)
|
||||||
//->where('vehicles.year', '<=', 1997)
|
//->where('vehicles.year', '<=', 1997)
|
||||||
->where('vehicles.doNotJudge', '=', 0)
|
->where('vehicles.doNotJudge', '=', 0)
|
||||||
->orderBy('totalscore','desc')
|
->orderBy('totalscore','desc')
|
||||||
->first();
|
->first();
|
||||||
return $NinetyEightToCurrentQuery->vehicle;
|
return $NinetyNineToCurrentQuery->vehicle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Truncate table first
|
// Truncate table first
|
||||||
@ -255,7 +255,7 @@ class TabulateWinners extends Command
|
|||||||
'place' => 'first'
|
'place' => 'first'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'vehicle' => sixtyEightToNinetySevenWinner()
|
'vehicle' => sixtyEightToNinetyEightWinner()
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
CarShowWinner::updateOrCreate(
|
CarShowWinner::updateOrCreate(
|
||||||
@ -264,7 +264,7 @@ class TabulateWinners extends Command
|
|||||||
'place' => 'second'
|
'place' => 'second'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'vehicle' => sixtyEightToNinetySevenWinner()
|
'vehicle' => sixtyEightToNinetyEightWinner()
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
CarShowWinner::updateOrCreate(
|
CarShowWinner::updateOrCreate(
|
||||||
@ -273,7 +273,7 @@ class TabulateWinners extends Command
|
|||||||
'place' => 'third'
|
'place' => 'third'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'vehicle' => sixtyEightToNinetySevenWinner()
|
'vehicle' => sixtyEightToNinetyEightWinner()
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -284,7 +284,7 @@ class TabulateWinners extends Command
|
|||||||
'place' => 'first'
|
'place' => 'first'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'vehicle' => NinetyEightToCurrentWinner()
|
'vehicle' => NinetyNineToCurrentWinner()
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
CarShowWinner::updateOrCreate(
|
CarShowWinner::updateOrCreate(
|
||||||
@ -293,7 +293,7 @@ class TabulateWinners extends Command
|
|||||||
'place' => 'second'
|
'place' => 'second'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'vehicle' => NinetyEightToCurrentWinner()
|
'vehicle' => NinetyNineToCurrentWinner()
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
CarShowWinner::updateOrCreate(
|
CarShowWinner::updateOrCreate(
|
||||||
@ -302,7 +302,7 @@ class TabulateWinners extends Command
|
|||||||
'place' => 'third'
|
'place' => 'third'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'vehicle' => NinetyEightToCurrentWinner()
|
'vehicle' => NinetyNineToCurrentWinner()
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user