diff --git a/models/acc_enedis_cdc.py b/models/acc_enedis_cdc.py
index 4369894263efd89a5589d4190e1d264e80214103..23611d713e03bb75714ad5236cdd5d50eafe16fb 100644
--- a/models/acc_enedis_cdc.py
+++ b/models/acc_enedis_cdc.py
@@ -106,9 +106,9 @@ class AccEnedisCdc(models.Model):
("date_slot", ">=", start_date_tz),
("date_slot", "<", end_date_tz),
]
- if partner_id and isinstance(partner_id, int):
+ if partner_id:
partner_domain = [("partner_id", "=", partner_id)]
- if prm_id and isinstance(prm_id, int):
+ if prm_id:
partner_domain = expression.AND(
[partner_domain, [("acc_counter_id", "=", prm_id)]]
)
@@ -263,10 +263,10 @@ class AccEnedisCdc(models.Model):
AND cdc.date_slot < '{end_datetime}'
"""
- if partner_id and isinstance(partner_id, int):
- result += f" AND ((cdc.partner_id = {partner_id} "
- if prm_id and isinstance(prm_id, int):
- result += f" AND cdc.acc_counter_id = {prm_id}) "
+ if partner_id:
+ result += f" AND ((cdc.partner_id = {int(partner_id)} "
+ if prm_id:
+ result += f" AND cdc.acc_counter_id = {int(prm_id)}) "
else:
result = f"{result})"
if extra_curve_type and extra_curve_type in (
diff --git a/templates/operation_templates_page.xml b/templates/operation_templates_page.xml
index fb91347694c32e4738b77e7233ed495fc7c89f51..b2003e29000973e017bd3f3d27344626551f37b3 100644
--- a/templates/operation_templates_page.xml
+++ b/templates/operation_templates_page.xml
@@ -248,10 +248,10 @@
</t>
</t>
</select>
- <a href="#" title="Export" target="_blank" class="fa fa-cloud-download btn btn-primary" id="export-data" >
- Exporter les<br/> données
+ <a href="#" title="Export" target="_blank" class="btn btn-primary" id="export-data" >
+ <i class="fa fa-cloud-download " />
+ <span class="d-none d-md-inline">Exporter les<br/> données</span>
</a>
-
</div>
</div>
</div>
diff --git a/tools/export_cdc.py b/tools/export_cdc.py
index 34563d4d6803c3a411e06d59a7a6c0cd98c7d39a..d34807e6c42c2fa70faf6d157d41b0e232af9c54 100644
--- a/tools/export_cdc.py
+++ b/tools/export_cdc.py
@@ -6,13 +6,13 @@ PROD_HEADER = [
"Production (W)",
"Production (kWh)",
"Surplus (kWh)",
- "Production autoconsommee (kWh)",
+ "Production autoconsommée (kWh)",
]
CONS_HEADER = [
"Horodatage",
"Consommation (W)",
"Consommation (kWh)",
- "Alloconsommation(kWh)",
+ "Alloconsommation (kWh)",
"Autoconsommation (kWh)",
]
@@ -88,6 +88,9 @@ def make_cons_data(raw_data):
:param raw_data:
:return:
"""
+
+ sum_value = {"cons": 0, "allo_cons": 0, "auto_cons": 0}
+
data_file_lines = []
rounding = 3
for row in raw_data:
@@ -108,6 +111,20 @@ def make_cons_data(raw_data):
)
)
+ sum_value["cons"] += round(row[1], rounding)
+ sum_value["allo_cons"] += round(row[3], rounding)
+ sum_value["auto_cons"] += round(row[2], rounding)
+
+ tot = ";".join(
+ [
+ "TOTAL",
+ "",
+ str(round(sum_value.get("cons"), rounding)),
+ str(round(sum_value.get("allo_cons"), rounding)),
+ str(round(sum_value.get("auto_cons"), rounding)),
+ ]
+ )
+ data_file_lines.insert(0, tot)
return data_file_lines
@@ -120,6 +137,7 @@ def make_prod_data(raw_data):
"""
data_file_lines = []
rounding = 3
+ sum_value = {"prod": 0, "surplus": 0, "auto_cons": 0}
for row in raw_data:
data_file_lines.append(
";".join(
@@ -137,6 +155,20 @@ def make_prod_data(raw_data):
]
)
)
+ sum_value["prod"] += round(row[3], rounding)
+ sum_value["surplus"] += round(row[2], rounding)
+ sum_value["auto_cons"] += round(row[1], rounding)
+
+ tot = ";".join(
+ [
+ "TOTAL",
+ "",
+ str(round(sum_value.get("prod"), rounding)),
+ str(round(sum_value.get("surplus"), rounding)),
+ str(round(sum_value.get("auto_cons"), rounding)),
+ ]
+ )
+ data_file_lines.insert(0, tot)
return data_file_lines