Add getActiveBatteries function. #733

This commit is contained in:
Korina Cordero 2023-02-06 10:42:01 +00:00
parent 765b3a99b9
commit ab2d6be08e

View file

@ -43,14 +43,10 @@ class GenerateBatteryCompatibilityCommand extends Command
$vehicles = $vm->getVehicles();
foreach ($vehicles as $vehicle)
{
$batteries = $vehicle->getBatteries();
$batteries = $vehicle->getActiveBatteries();
$comp_batt = [];
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
$comp_batt['id'] = $battery->getID();
$comp_batt['name'] = $battery->getModel()->getName() . ' ' .