Skip to content

Commit

Permalink
Merge pull request #73 from gisce/fix_end_date_cups45_cupsdat
Browse files Browse the repository at this point in the history
Cambio de formato en los ficheros CUPSDAT y CUPS45
  • Loading branch information
davidmunoznovoa authored Aug 6, 2024
2 parents 4f00cf7 + 679fb12 commit 22a1c33
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mesures/cupsdat.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def reader(self, file_path):
)

df['fecha_hora_final_vigencia'] = df.apply(
lambda row: REE_END_DATE_HOUR
lambda row: CUPSDAT_CPUS45_REE_END_DATE_HOUR
if row['fecha_hora_final_vigencia'] == ''
else datetime.strptime(row['fecha_hora_final_vigencia'], '%Y-%m-%d %H').strftime(DATE_MASK), axis=1)

Expand Down
3 changes: 3 additions & 0 deletions mesures/dates/date.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
REE_END_DATE = '30000101'
REE_END_DATE_HOUR = '3000/01/01 01'
SIMPLE_DATE_MASK = '%Y%m%d'

# Since v41 of SIMEL specifications
CUPSDAT_CPUS45_REE_END_DATE_HOUR = '3000/01/01 00'
4 changes: 2 additions & 2 deletions spec/generation_files_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@ def get_sample_reobjecil_data():
expected = 'ES0291000000004444QR1F;CUPS de Demo 01;X0004444;4444;5555;2;' \
'E2;6A;G0;A;GI;400;400;400;400;400;500;1091;2022/10/01 01;2022/10/17 00;17005;S;27\n' \
'ES0291000000005555QR1F;CUPS de Demo 02;X0005555;4444;5555;2;' \
'E2;6A;G0;A;GI;400;400;400;400;400;500;1091;2022/10/17 01;3000/01/01 01;17005;S;27\n'
'E2;6A;G0;A;GI;400;400;400;400;400;500;1091;2022/10/17 01;3000/01/01 00;17005;S;27\n'
assert f.file[f.columns].to_csv(sep=';', header=None, index=False) == expected

with description('A CUPS45'):
Expand All @@ -1312,7 +1312,7 @@ def get_sample_reobjecil_data():
f = CUPS45(data)
res = f.writer()
expected = 'ES0291000000004444QR1F;4444;5555;5;E0;2T;E3;GI;4;4;5;0;0;0;S;2022/10/01 01;2022/10/17 00;0968;17005\n' \
'ES0291000000005555QR1F;4444;5555;5;E0;2T;E3;GI;4;4;4;0;0;0;S;2022/10/17 01;3000/01/01 01;0968;17005\n'
'ES0291000000005555QR1F;4444;5555;5;E0;2T;E3;GI;4;4;4;0;0;0;S;2022/10/17 01;3000/01/01 00;0968;17005\n'
assert f.file[f.columns].to_csv(sep=';', header=None, index=False) == expected

with description('A MCIL345'):
Expand Down

0 comments on commit 22a1c33

Please sign in to comment.