From ac08143308daef13cc6664a120688f9aa328413a Mon Sep 17 00:00:00 2001 From: Marc Calvo Date: Mon, 19 Aug 2024 11:55:12 +0200 Subject: [PATCH 1/2] improve method get_coeficient_repartiment --- gestionatr/input/messages/F1.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gestionatr/input/messages/F1.py b/gestionatr/input/messages/F1.py index 1a6b1e5..f7ebe3c 100644 --- a/gestionatr/input/messages/F1.py +++ b/gestionatr/input/messages/F1.py @@ -504,6 +504,9 @@ def get_coeficient_repartiment(self): for periode in terme.Periodo: if periode and (float(periode.Beta.text) or float(periode.Beta.text) == 0.0): beta_list.append(float(periode.Beta.text)) + # If it's a 2.0TD and we have 6 periods, we pop the last 3 (P4, P5, P6) + if self.factura.datos_factura.tarifa_atr_fact == '018' and len(beta_list) == 6: + beta_list = beta_list[:len(beta_list)-3] return list(set(beta_list)) except AttributeError: # We might not have any "Coeficient de repartiment" in EnergiaNetaGen From e13f8965a36b095ff67482e9c81a2d8d0c4214bb Mon Sep 17 00:00:00 2001 From: Marc Calvo Date: Mon, 19 Aug 2024 14:45:23 +0200 Subject: [PATCH 2/2] fix code --- gestionatr/input/messages/F1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gestionatr/input/messages/F1.py b/gestionatr/input/messages/F1.py index f7ebe3c..d22db88 100644 --- a/gestionatr/input/messages/F1.py +++ b/gestionatr/input/messages/F1.py @@ -505,7 +505,7 @@ def get_coeficient_repartiment(self): if periode and (float(periode.Beta.text) or float(periode.Beta.text) == 0.0): beta_list.append(float(periode.Beta.text)) # If it's a 2.0TD and we have 6 periods, we pop the last 3 (P4, P5, P6) - if self.factura.datos_factura.tarifa_atr_fact == '018' and len(beta_list) == 6: + if self.datos_factura.tarifa_atr_fact == '018' and len(beta_list) == 6: beta_list = beta_list[:len(beta_list)-3] return list(set(beta_list)) except AttributeError: