Skip to content
Snippets Groups Projects
Verified Commit 46653c89 authored by Marco Aceti's avatar Marco Aceti
Browse files

Use isoformat instead of timestamp in train export

parent 9190d399
Branches extractor
No related tags found
No related merge requests found
Pipeline #2720 passed
...@@ -5,6 +5,7 @@ import pickle ...@@ -5,6 +5,7 @@ import pickle
from datetime import date, datetime, timedelta from datetime import date, datetime, timedelta
from pathlib import Path from pathlib import Path
from src.const import TIMEZONE
from src.scraper.train import Train from src.scraper.train import Train
from src.scraper.train_stop import TrainStopTime from src.scraper.train_stop import TrainStopTime
from src.utils import parse_input_format_output_args from src.utils import parse_input_format_output_args
...@@ -36,6 +37,7 @@ def load_file(file: Path) -> dict[int, Train]: ...@@ -36,6 +37,7 @@ def load_file(file: Path) -> dict[int, Train]:
year=dep_date.year, year=dep_date.year,
month=dep_date.month, month=dep_date.month,
day=dep_date.day, day=dep_date.day,
tzinfo=TIMEZONE,
) )
if dt.hour < 4: if dt.hour < 4:
...@@ -119,17 +121,17 @@ def to_csv(data: dict[int, Train], output_file: Path) -> None: ...@@ -119,17 +121,17 @@ def to_csv(data: dict[int, Train], output_file: Path) -> None:
stop.station.code, stop.station.code,
stop.stop_type.value, stop.stop_type.value,
stop.platform_actual or stop.platform_expected, stop.platform_actual or stop.platform_expected,
stop.arrival.expected.timestamp() stop.arrival.expected.isoformat()
if stop.arrival and stop.arrival.expected if stop.arrival and stop.arrival.expected
else None, else None,
stop.arrival.actual.timestamp() stop.arrival.actual.isoformat()
if stop.arrival and stop.arrival.actual if stop.arrival and stop.arrival.actual
else None, else None,
stop.arrival.delay() if stop.arrival else None, stop.arrival.delay() if stop.arrival else None,
stop.departure.expected.timestamp() stop.departure.expected.isoformat()
if stop.departure and stop.departure.expected if stop.departure and stop.departure.expected
else None, else None,
stop.departure.actual.timestamp() stop.departure.actual.isoformat()
if stop.departure and stop.departure.actual if stop.departure and stop.departure.actual
else None, else None,
stop.departure.delay() if stop.departure else None, stop.departure.delay() if stop.departure else None,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment