mirror of
https://github.com/flobz/psa_car_controller.git
synced 2026-08-22 01:16:14 +00:00
fix(web): #343
This commit is contained in:
@@ -9,7 +9,7 @@ from .ecomix import Ecomix
|
||||
|
||||
from psa_car_controller.psacc.repository.config_repository import ElectricityPriceConfig
|
||||
from psa_car_controller.psacc.repository.db import Database
|
||||
from ..model.car import Car
|
||||
from ..model.car import Car, Cars
|
||||
from ..model.charge import Charge
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -37,7 +37,7 @@ class Charging:
|
||||
charge.price = Charging.elec_price.get_price(charge, battery_curves)
|
||||
|
||||
@staticmethod
|
||||
def set_default_price(cars):
|
||||
def set_default_price(cars: Cars):
|
||||
if Charging.elec_price.is_enable():
|
||||
conn = Database.get_db()
|
||||
charge_list = Database.get_all_charge_without_price(conn)
|
||||
|
||||
@@ -39,7 +39,7 @@ min_date = max_date = min_millis = max_millis = step = marks = cached_layout = N
|
||||
APP = PSACarController()
|
||||
|
||||
|
||||
def get_default_car():
|
||||
def get_default_car() -> Car:
|
||||
return APP.myp.vehicles_list[0]
|
||||
|
||||
|
||||
@@ -396,7 +396,7 @@ def serve_layout():
|
||||
|
||||
try:
|
||||
if APP.is_good:
|
||||
Charging.set_default_price(get_default_car())
|
||||
Charging.set_default_price(APP.myp.vehicles_list)
|
||||
Database.set_db_callback(update_trips)
|
||||
update_trips()
|
||||
except (IndexError, TypeError):
|
||||
|
||||
Reference in New Issue
Block a user