stationsWithCars() {
return this.cars.reduce(
(acc, n) => (acc[n.address]?.cars.push(n), n.count++, acc),
Object.fromEntries(this.stations.map(n => [ n.name, { station: n, cars: [], sum: 0 } ]))
);
},
computed: {
stationsWithCars() {
return this.cars.reduce(
(acc, n) => (acc[n.address]?.cars.push(n), acc),
Object.fromEntries(this.stations.map(n => [ n.name, { station: n, cars: [] } ]))
);
},
carsSumGas() {
return this.cars.reduce((s, i) => s = s + i.count, 0)
}
},