Fixed Generating Report

This commit is contained in:
jmueller
2023-12-14 23:02:21 +01:00
parent c1eeb47217
commit bee606c4bb

10
main.py
View File

@@ -733,11 +733,15 @@ async def process_generate_report(select, interaction):
guild = interaction.guild
for recruit in select.values:
cur.execute(
"SELECT recruits.nickname, count(yes_votes.id), count(no_votes.id) FROM recruits LEFT JOIN no_votes ON recruits.discord_id = no_votes.discord_id_recruit LEFT JOIN yes_votes ON recruits.discord_id = yes_votes.discord_id_recruit WHERE recruits.discord_id = ?",
"SELECT recruits.nickname FROM recruits WHERE recruits.discord_id = ?",
(recruit,))
data = cur.fetchone()
description = description + "**" + str(data[0]) + ":** " + str(data[1]) + " Ja | " + str(data[2]) + "Nein -> \n"
if data[1] != 0:
cur.execute("SELECT count(*) FROM yes_votes WHERE discord_id_recruit = ?", (recruit, ))
yes_count = cur.fetchone()[0]
cur.execute("SELECT count(*) FROM no_votes WHERE discord_id_recruit = ?", (recruit, ))
no_count = cur.fetchone()[0]
description = description + "**" + str(data[0]) + ":** " + str(yes_count) + " Ja | " + str(no_count) + " Nein -> \n"
if no_count != 0:
cur.execute("SELECT discord_id_voter, reason FROM no_votes WHERE discord_id_recruit = ?", (recruit,))
no_votes = cur.fetchall()
for vote in no_votes: