From 7b3e7b7b10271f31f5b7526aa24abc0ca5508ac7 Mon Sep 17 00:00:00 2001 From: Anderson T Date: Wed, 4 Dec 2024 08:28:34 -0800 Subject: [PATCH] fix reverted bug --- sdk/fetch_events.py | 13 ++++++++----- sdk/fetch_execs.py | 6 ++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/sdk/fetch_events.py b/sdk/fetch_events.py index 34ec203..f6c11f5 100644 --- a/sdk/fetch_events.py +++ b/sdk/fetch_events.py @@ -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. diff --git a/sdk/fetch_execs.py b/sdk/fetch_execs.py index c8fa676..fe89555 100644 --- a/sdk/fetch_execs.py +++ b/sdk/fetch_execs.py @@ -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.