fix: Hardcoded eur symbol for currency in figures.py #722

This commit is contained in:
Florian Bezannier
2024-01-15 22:30:55 +01:00
committed by Florian BEZANNIER
parent e9b5a84437
commit a580377129
2 changed files with 17 additions and 15 deletions
+14 -12
View File
@@ -37,18 +37,20 @@ AVG_CONSUM_PRICE = "avg_consum_price"
CURRENCY = ""
EXPORT_FORMAT = "csv"
SUMMARY_CARDS = {"Average consumption": {"text": [card_value_div(AVG_CONSUM_KW, "kWh/100km"),
card_value_div(AVG_CONSUM_PRICE, f"{CURRENCY}/100km")],
"src": "assets/images/consumption.svg"},
"Average emission": {"text": [card_value_div(AVG_EMISSION_KM, " g/km"),
card_value_div(AVG_EMISSION_KW, "g/kWh")],
"src": "assets/images/pollution.svg"},
"Average charge speed": {"text": [card_value_div(AVG_CHARGE_SPEED, " kW")],
"src": "assets/images/battery-charge-line.svg"},
"Electricity consumption": {"text": [card_value_div(ELEC_CONSUM_KW, "kWh"),
card_value_div(ELEC_CONSUM_PRICE, CURRENCY)],
"src": "assets/images/electricity bill.svg"}
}
def get_summary_cards():
return {"Average consumption": {"text": [card_value_div(AVG_CONSUM_KW, "kWh/100km"),
card_value_div(AVG_CONSUM_PRICE, f"{CURRENCY}/100km")],
"src": "assets/images/consumption.svg"},
"Average emission": {"text": [card_value_div(AVG_EMISSION_KM, " g/km"),
card_value_div(AVG_EMISSION_KW, "g/kWh")],
"src": "assets/images/pollution.svg"},
"Average charge speed": {"text": [card_value_div(AVG_CHARGE_SPEED, " kW")],
"src": "assets/images/battery-charge-line.svg"},
"Electricity consumption": {"text": [card_value_div(ELEC_CONSUM_KW, "kWh"),
card_value_div(ELEC_CONSUM_PRICE, CURRENCY)],
"src": "assets/images/electricity bill.svg"}
}
def get_figures(car: Car):
+3 -3
View File
@@ -169,8 +169,6 @@ def create_callback(): # noqa: MC0001
[Input("export-battery-table", "n_clicks")]
)
figures.CURRENCY = APP.config.General.currency
figures.EXPORT_FORMAT = APP.config.General.export_format
CALLBACK_CREATED = True
@@ -237,9 +235,11 @@ def serve_layout():
marks=marks,
value=[min_millis, max_millis],
)
figures.CURRENCY = APP.config.General.currency
figures.EXPORT_FORMAT = APP.config.General.export_format
summary_tab = [
dbc.Container(dbc.Row(id="summary-cards",
children=create_card(figures.SUMMARY_CARDS)), fluid=True),
children=create_card(figures.get_summary_cards())), fluid=True),
fig_filter.add_graph(dcc.Graph(id="consumption_fig"), "start_at", ["consumption_km"],
figures.consumption_fig),
fig_filter.add_graph(dcc.Graph(id="consumption_fig_by_speed"), "speed_average",