aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPinapelz <donaldshan1@outlook.com>2023-07-07 23:44:04 -0700
committerPinapelz <donaldshan1@outlook.com>2023-07-07 23:44:04 -0700
commit645cacc6790852bad9eb04755b911bd432200c1c (patch)
treeeff5e4c7be17fad59b477b5f3fd19f3f2c91471a
parent5c48dcb23ac331a514d5af995edfcddd91e93a6f (diff)
fix: bug where data is not recorded into historical table
-rw-r--r--nijitrack.py3
-rw-r--r--sql/sql_handler.py2
2 files changed, 2 insertions, 3 deletions
diff --git a/nijitrack.py b/nijitrack.py
index 9e30e0e..5815066 100644
--- a/nijitrack.py
+++ b/nijitrack.py
@@ -30,11 +30,9 @@ def record_subscriber_data(data: list):
if not server.check_row_exists(CONFIG["TABLES"]["daily"], "channel_id", channel_id):
# data_tuple = (channel_id, pfp, channel_name, sub_count, time.strftime('%Y-%m-%d %H:%M:%S'))
server.insert_row(CONFIG["TABLES"]["daily"], DATA_SETTING["DAILY_HEADER"], (data_tuple[0], data_tuple[3]))
- server.insert_row(name = CONFIG["TABLES"]["historical"], column = DATA_SETTING["LIVE_HEADER"], data=data_tuple)
return
elif refresh_daily:
server.update_row(CONFIG["TABLES"]["daily"], "sub_count", sub_count, "channel_id", channel_id)
- server.insert_row(name = CONFIG["TABLES"]["historical"], column = DATA_SETTING["LIVE_HEADER"], data=data_tuple)
exclude_channels = fs.get_excluded_channels()
for channel in data:
@@ -49,6 +47,7 @@ def record_subscriber_data(data: list):
channel_name = transform_sql_string(channel_name)
data_tuple = (channel_id, pfp, channel_name, sub_count, time.strftime('%Y-%m-%d %H:%M:%S'))
server.insert_row(name = CONFIG["TABLES"]["live"], column = DATA_SETTING["LIVE_HEADER"], data=data_tuple)
+ server.insert_row(name = CONFIG["TABLES"]["historical"], column = DATA_SETTING["LIVE_HEADER"], data=data_tuple)
record_diff_data(data_tuple)
@log("Generating Indvidual Channel Pages")
diff --git a/sql/sql_handler.py b/sql/sql_handler.py
index a02db52..7260b0e 100644
--- a/sql/sql_handler.py
+++ b/sql/sql_handler.py
@@ -62,7 +62,7 @@ class SQLHandler:
query = f"INSERT INTO {name} ({column}) VALUES ({placeholders})"
cursor.execute(query, data)
self.connection.commit()
- print("Data Inserted:", data)
+ print("Data Inserted:", data, "into", name)
except Error as err:
print("Error inserting data")
print(err)
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage