mirror of
https://github.com/flobz/psa_car_controller.git
synced 2026-08-23 09:56:14 +00:00
Merge pull request #487 from Philippehaz/Issue-486
Fix #486 and maybe #437
This commit is contained in:
@@ -21,7 +21,7 @@ class BatteryChargeCurve:
|
||||
conn = Database.get_db()
|
||||
conn.close()
|
||||
battery_curves = []
|
||||
if len(battery_curves_dto) > 0 and battery_curves_dto[-1].level > 0:
|
||||
if len(battery_curves_dto) > 0 and battery_curves_dto[-1].level > 0 and battery_curves_dto[-1].autonomy > 0:
|
||||
battery_capacity = battery_curves_dto[-1].level * car.battery_power / 100
|
||||
km_by_kw = 0.8 * battery_curves_dto[-1].autonomy / battery_capacity
|
||||
start = 0
|
||||
|
||||
@@ -182,7 +182,8 @@ class Database:
|
||||
battery_curves = []
|
||||
res = conn.execute("""SELECT date, level, rate, autonomy
|
||||
FROM battery_curve
|
||||
WHERE start_at=? and date<=? and VIN=?;""",
|
||||
WHERE start_at=? and date<=? and VIN=?
|
||||
ORDER BY date asc;""",
|
||||
(start_at, stop_at, vin)).fetchall()
|
||||
for row in res:
|
||||
battery_curves.append(BatteryCurveDto(**dict_key_to_lower_case(**row)))
|
||||
|
||||
Reference in New Issue
Block a user