mirror of
https://github.com/flobz/psa_car_controller.git
synced 2026-08-26 10:17:18 +00:00
filter every element on clientside
This commit is contained in:
@@ -38,6 +38,12 @@ class Car:
|
||||
def is_hybrid(self) -> bool:
|
||||
return self.fuel_capacity > 0 and self.battery_power > 0
|
||||
|
||||
def has_battery(self):
|
||||
return self.battery_power > 0
|
||||
|
||||
def has_fuel(self):
|
||||
return self.fuel_capacity > 0
|
||||
|
||||
def get_status(self):
|
||||
if self.status is not None:
|
||||
return self.status
|
||||
|
||||
+2
-10
@@ -13,17 +13,9 @@ class Charging:
|
||||
elec_price: ElecPrice = ElecPrice(None)
|
||||
|
||||
@staticmethod
|
||||
def get_chargings(mini=None, maxi=None) -> List[dict]:
|
||||
def get_chargings() -> List[dict]:
|
||||
conn = Database.get_db()
|
||||
if mini is not None:
|
||||
if maxi is not None:
|
||||
res = conn.execute("select * from battery WHERE start_at>=? and start_at<=?", (mini, maxi)).fetchall()
|
||||
else:
|
||||
res = conn.execute("select * from battery WHERE start_at>=?", (mini,)).fetchall()
|
||||
elif maxi is not None:
|
||||
res = conn.execute("select * from battery WHERE start_at<=?", (maxi,)).fetchall()
|
||||
else:
|
||||
res = conn.execute("select * from battery").fetchall()
|
||||
res = conn.execute("select * from battery ORDER BY start_at").fetchall()
|
||||
conn.close()
|
||||
return list(map(dict, res))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user