diff options
| author | Pinapelz <yukais@pinapelz.com> | 2024-10-04 11:24:29 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2024-10-04 11:28:45 -0700 |
| commit | 4460f22ad6dba3e7c2b1ade3fe7252406fd048fe (patch) | |
| tree | 25ec6208dd0014bcb17b96f2d420d6d1543e1630 | |
| parent | dbfc935df97dca1816883a4c50f96366b2cd4d33 (diff) | |
change check_diff_refresh logic to handle 0 rows in table
| -rw-r--r-- | nijitrack.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/nijitrack.py b/nijitrack.py index 46816f7..d40bc0b 100644 --- a/nijitrack.py +++ b/nijitrack.py @@ -58,10 +58,10 @@ def record_subscriber_data(data: list, force_refresh: bool = False): def check_diff_refresh(): last_updated = server.get_most_recently_added_row_time(DATA_SETTING["TABLE_HISTORICAL"]) - if not last_updated: + if last_updated is None or len(last_updated) == 0 or not last_updated[0]: print("Failed to get the most recently added row time.") return False - last_updated = pytz.timezone('US/Pacific').localize(last_updated) + last_updated = pytz.timezone('US/Pacific').localize(last_updated[0]) utc_now = datetime.now(pytz.timezone('UTC')) pst_now = utc_now.astimezone(pytz.timezone('US/Pacific')) time_diff = pst_now - last_updated |
