constrained download mode for accounts list

This commit is contained in:
katboi01 2025-01-17 14:12:47 +01:00
parent fee0ecfe75
commit 8733294f13
2 changed files with 7 additions and 4 deletions

View File

@ -62,9 +62,10 @@ class Database:
SUM(IIF(x_posts.action_taken = 2, 1, 0)) as deleted, SUM(IIF(x_posts.action_taken = 2, 1, 0)) as deleted,
SUM(IIF(x_posts.action_taken = 3, 1, 0)) as hidden, SUM(IIF(x_posts.action_taken = 3, 1, 0)) as hidden,
SUM(IIF(x_post_details.id is NULL, 1, 0)) as invalid SUM(IIF(x_post_details.id is NULL, 1, 0)) as invalid
FROM x_posts FROM accounts
LEFT JOIN accounts on accounts.id = x_posts.account_id LEFT JOIN x_posts on accounts.id = x_posts.account_id
LEFT JOIN x_post_details on x_post_details.id = x_posts.id LEFT JOIN x_post_details on x_post_details.id = x_posts.id
WHERE accounts.download_mode != 4
GROUP BY account_id GROUP BY account_id
ORDER BY x_handle''' ORDER BY x_handle'''
return self.db.run_query(query) return self.db.run_query(query)

View File

@ -27,19 +27,21 @@ class DatabaseController:
return result > 0 return result > 0
except Exception as e: except Exception as e:
self.conn.rollback() self.conn.rollback()
print(e) print(command, e)
return False return False
def run_commands(self, commands): def run_commands(self, commands):
last_command = ""
try: try:
for command in commands: for command in commands:
last_command = command
self.cursor.execute(command) self.cursor.execute(command)
result = self.cursor.rowcount result = self.cursor.rowcount
self.conn.commit() self.conn.commit()
return result > 0 return result > 0
except Exception as e: except Exception as e:
self.conn.rollback() self.conn.rollback()
print(e) print(last_command, e)
return False return False
def close(self): def close(self):