Skip to content

Commit

Permalink
Merge pull request #656 from gisce/bugfix/59876_date_parser_B1_accept…
Browse files Browse the repository at this point in the history
…_timestamp_or_date

FIX parseo fecha para aceptar recibir tipo timestamp o fecha en B2
  • Loading branch information
ecarreras authored Jun 14, 2024
2 parents 019e346 + 271652b commit b7dd1d1
Showing 1 changed file with 27 additions and 14 deletions.
41 changes: 27 additions & 14 deletions libcnmc/cir_8_2021/FB2.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,23 +266,36 @@ def get_inst_name(element_id):
#DATA_BAIXA, CAUSA_BAJA
if ct['data_baixa']:
if ct['data_baixa'] < data_pm_limit:
tmp_date = datetime.strptime(
ct['data_baixa'], '%Y-%m-%d %H:%M:%S')
fecha_baja = tmp_date.strftime('%d/%m/%Y')

if int(fecha_baja.split("/")[2]) - int(data_pm.split("/")[2]) >= 40:
if identificador_baja != '':
causa_baja = 1
tmp_date = ''
try:
tmp_date = datetime.strptime(
ct['data_baixa'], '%Y-%m-%d %H:%M:%S'
)
except ValueError:
try:
tmp_date = datetime.strptime(
ct['data_baixa'], '%Y-%m-%d'
)
except ValueError:
traceback.print_exc()
if self.raven:
self.raven.captureException()
if tmp_date:
fecha_baja = tmp_date.strftime('%d/%m/%Y')
if (int(fecha_baja.split("/")[2])
- int(data_pm.split("/")[2]) >= 40):
if identificador_baja != '':
causa_baja = 1
else:
causa_baja = 2
else:
causa_baja = 2
else:
causa_baja = 3
causa_baja = 3
else:
fecha_baja = ''
causa_baja = 0;
causa_baja = 0
else:
fecha_baja = ''
causa_baja = 0;
causa_baja = 0

#CCUU
if ct['tipus_instalacio_cnmc_id']:
Expand All @@ -307,9 +320,9 @@ def get_inst_name(element_id):
if ct["node_baixa"]:
o_node_baixa = ct["node_baixa"][1]
if o_node_baixa == 0:
o_node_baixa = '';
o_node_baixa = ''
else:
o_node_baixa = '';
o_node_baixa = ''

if ct['cini']:
cini = ct['cini']
Expand Down

0 comments on commit b7dd1d1

Please sign in to comment.