Skip to content

Commit 242f327

Browse files
committed
only parse end_utc if end_utc exists (insert_event_to_db)
1 parent 0744fed commit 242f327

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

backend/scraping/instagram_feed.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,9 @@ def insert_event_to_db(event_data, ig_handle, source_url):
279279
event_dates = []
280280

281281
for occ in occurrences:
282-
# Parse start_utc
283282
dtstart_utc = parse_datetime(occ.get("start_utc"))
284-
if not dtstart_utc:
285-
continue # Skip occurrences without start time
286-
287-
# Parse end_utc (can be empty string or None)
288-
dtend_utc = parse_datetime(occ.get("end_utc"))
283+
dtend_utc_raw = occ.get("end_utc")
284+
dtend_utc = parse_datetime(dtend_utc_raw) if dtend_utc_raw and dtend_utc_raw.strip() else None
289285

290286
event_dates.append(
291287
EventDates(

0 commit comments

Comments
 (0)