From 923399ed20c493fbcd607b163a699d397605e61c Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Sat, 8 Jul 2023 02:12:49 -0700 Subject: fix: sql column configured in incorrect order --- html_builders/tables.py | 2 ++ nijitrack.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/html_builders/tables.py b/html_builders/tables.py index 2ffe443..a1d3a62 100644 --- a/html_builders/tables.py +++ b/html_builders/tables.py @@ -3,6 +3,8 @@ def generate_html_table(server, table, diff_table, headers=["Rank", "Liver", "Su diff_cursor = server.get_connection().cursor() diff_cursor.execute(query) diff_data = diff_cursor.fetchall() + if len(diff_data) == 0: + return "N/A" old_sub_count = int(diff_data[0][0]) current_sub_count = int(sub_count_str) if old_sub_count > current_sub_count: diff --git a/nijitrack.py b/nijitrack.py index 509e9d3..1a0a4d2 100644 --- a/nijitrack.py +++ b/nijitrack.py @@ -31,7 +31,7 @@ def record_subscriber_data(data: list): server.insert_row(CONFIG["TABLES"]["daily"], DATA_SETTING["DAILY_HEADER"], (data_tuple[0], data_tuple[3])) return elif refresh_daily: - server.update_row(CONFIG["TABLES"]["daily"], "sub_diff", sub_count, "channel_id", channel_id) + server.update_row(CONFIG["TABLES"]["daily"], "channel_id", channel_id, "sub_diff", sub_count) exclude_channels = fs.get_excluded_channels() refresh_daily = fs.check_diff_refresh() @@ -123,5 +123,5 @@ if __name__ == "__main__": else: channel_data, inactive_channels = holodex_generation(server) fs.update_excluded_channels(inactive_channels) - generate_individual_pages(server, channel_data) builder.build_ranking_page(server, CONFIG, combine_excluded_channel_ids(inactive_channels, fs.get_excluded_channels())) + generate_individual_pages(server, channel_data) -- cgit v1.2.3