Add getActiveBatteries function. #733
This commit is contained in:
parent
765b3a99b9
commit
ab2d6be08e
1 changed files with 1 additions and 5 deletions
|
|
@ -43,14 +43,10 @@ class GenerateBatteryCompatibilityCommand extends Command
|
||||||
$vehicles = $vm->getVehicles();
|
$vehicles = $vm->getVehicles();
|
||||||
foreach ($vehicles as $vehicle)
|
foreach ($vehicles as $vehicle)
|
||||||
{
|
{
|
||||||
$batteries = $vehicle->getBatteries();
|
$batteries = $vehicle->getActiveBatteries();
|
||||||
$comp_batt = [];
|
$comp_batt = [];
|
||||||
foreach ($batteries as $battery)
|
foreach ($batteries as $battery)
|
||||||
{
|
{
|
||||||
// check if battery is active
|
|
||||||
if (!($battery->isActive()))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// set to the first compatible battery found until a more expensive one is found
|
// set to the first compatible battery found until a more expensive one is found
|
||||||
$comp_batt['id'] = $battery->getID();
|
$comp_batt['id'] = $battery->getID();
|
||||||
$comp_batt['name'] = $battery->getModel()->getName() . ' ' .
|
$comp_batt['name'] = $battery->getModel()->getName() . ' ' .
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue