Skip to content

Commit

Permalink
fix reverted bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Highfire1 committed Dec 4, 2024
1 parent 3f83e32 commit 7b3e7b7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
13 changes: 8 additions & 5 deletions sdk/fetch_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,18 @@ def updateDataFromNotion(writeLocation="data/") -> bool:
for page in event_pages["results"]:
p = page["properties"]
stale_data = False
found = False

for event in local_data.events:
if event.id == page["id"] and event.last_edited_time == page["last_edited_time"]:
stale_data = True
break
if event.id == page["id"]:
found = True
if event.last_edited_time == page["last_edited_time"]:
stale_data = True
break

if not stale_data:
if not stale_data or not found:
update_count += 1
if page["last_edited_time"] > events_latest_update:
if page["last_edited_time"] > events_latest_update and found:
events_latest_update = page["last_edited_time"]

# if there are no new updates then we should save the time that we last checked and then exit.
Expand Down
6 changes: 4 additions & 2 deletions sdk/fetch_execs.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,18 @@ def updateDataFromNotion(writeLocation="data/") -> bool:
for page in exec_pages["results"]:
p = page["properties"]
stale_data = False
found = False

for exec in local_data.executives:
if exec.id == page["id"]: # Compare with page_id
found = True
if page["last_edited_time"] == exec.last_edited_time:
stale_data = True
break

if not stale_data:
if not stale_data or not found:
update_count += 1
if page["last_edited_time"] > execs_latest_update:
if page["last_edited_time"] > execs_latest_update and found:
execs_latest_update = page["last_edited_time"]

# if there are no new updates then we should save the time that we last checked and then exit.
Expand Down

0 comments on commit 7b3e7b7

Please sign in to comment.