Skip to content

Commit b951d06

Browse files
committed
change to yesterday instead
1 parent b24058b commit b951d06

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

src/datasync/pit_registering_salmon.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,6 @@ def biomark_pit_salmon(
179179
paginator=SinglePagePaginator(),
180180
)
181181

182-
# set default dates if not provided
183-
if begin_date is None or end_date is None:
184-
log.info("Start date or end date is None, setting to yesterday")
185-
begin_date = (datetime.today() - timedelta(days=1)).strftime("%Y-%m-%d")
186-
end_date = datetime.today().strftime("%Y-%m-%d")
187-
188182
try:
189183
if tags:
190184
tags_resource = dlt.resource(
@@ -237,7 +231,7 @@ def run(
237231
False, help="Download data from all accessible locations"
238232
),
239233
base_url: str = BIOMARK_BASE_URL,
240-
today: bool = typer.Option(False, help="Set date range to today only"),
234+
yesterday: bool = typer.Option(False, help="Set date range to yesterday only"),
241235
dataset_name: str = BIOMARK_DATASET_NAME,
242236
):
243237
"""Download PIT data from BioMark's API to a .duckdb file."""
@@ -255,10 +249,10 @@ def run(
255249
"--tags, --readers, or --environment"
256250
)
257251

258-
if today:
259-
begin_date = (datetime.today() - timedelta(days=1)).strftime("%Y-%m-%d")
260-
end_date = datetime.today().strftime("%Y-%m-%d")
261-
log.info("Setting date range to today", date=begin_date)
252+
if yesterday:
253+
begin_date = (datetime.today() - timedelta(days=2)).strftime("%Y-%m-%d")
254+
end_date = (datetime.today() - timedelta(days=1)).strftime("%Y-%m-%d")
255+
log.info("Setting date range to yesterday", date=begin_date)
262256

263257
if all_locations:
264258
# skip 'vatne' (0NO) as it returns 403 Forbidden

0 commit comments

Comments
 (0)