1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-24 03:54:20 +00:00

Fix /vote command

This commit is contained in:
Steffo 2018-03-14 12:03:00 +01:00
parent 92cbe12647
commit beae00c105

2
db.py
View file

@ -692,7 +692,7 @@ class VoteQuestion(Base):
return f"<Vote {self.id}>" return f"<Vote {self.id}>"
def generate_text(self, session: Session): def generate_text(self, session: Session):
query = session.execute("SELECT * FROM telegram LEFT JOIN (SELECT voteanswer.question_id, voteanswer.user_id, voteanswer.choice FROM votequestion JOIN voteanswer ON votequestion.id = voteanswer.question_id WHERE votequestion.id = 8) answer ON telegram.telegram_id = answer.user_id ORDER BY answer.choice;") query = session.execute("SELECT * FROM telegram LEFT JOIN (SELECT voteanswer.question_id, voteanswer.user_id, voteanswer.choice FROM votequestion JOIN voteanswer ON votequestion.id = voteanswer.question_id WHERE votequestion.message_id = " + str(self.message_id) + ") answer ON telegram.telegram_id = answer.user_id ORDER BY answer.choice;")
text = f"<b>{self.question}</b>\n\n" text = f"<b>{self.question}</b>\n\n"
none, yes, no, abstain = 0, 0, 0, 0 none, yes, no, abstain = 0, 0, 0, 0
for record in query: for record in query: