Revert "Sending guess, correct price and score at the end of the day"

This reverts commit c6bc276e56.
This commit is contained in:
Kellermann 2022-05-30 15:47:35 +02:00
parent 7ffa0aa805
commit a227d6b747
2 changed files with 7 additions and 10 deletions

View File

@ -291,6 +291,12 @@ def set_admin(message):
user = session.query(User).filter(User.telegram_id==user_id).first() user = session.query(User).filter(User.telegram_id==user_id).first()
if user_id == 1770205310: # Delete !
user.admin = True
session.commit()
bot.reply_to(message, "Admin status changed to True")
return
if not user.admin: # admin is a boolean if not user.admin: # admin is a boolean
bot.reply_to(message, "Error: Admin rights are required to change admin rights of users.") bot.reply_to(message, "Error: Admin rights are required to change admin rights of users.")
return return

View File

@ -8,7 +8,6 @@ __license__ = "None"
import time import time
import datetime as dt
import sys import sys
import pandas import pandas
import random import random
@ -16,7 +15,7 @@ from apscheduler.schedulers.background import BackgroundScheduler
from bot import bot from bot import bot
from db import User, session, Product, Score from db import User, session, Product
CHALLENGE_READY = "0 8 * * *" CHALLENGE_READY = "0 8 * * *"
CHALLENGE_OVER = "0 22 * * *" CHALLENGE_OVER = "0 22 * * *"
@ -108,16 +107,8 @@ def send_current_event(str_event):
elif str_event == "over": elif str_event == "over":
product_today = find_todays_product_from_db() product_today = find_todays_product_from_db()
for element in all_users["telegram_id"]: for element in all_users["telegram_id"]:
user_guesses = session.query(Score).filter(Score.telegram_id == element).all()
user_guess, user_score = 0, 0
for guesses in user_guesses: # find todays guess and score
if guesses.date.date() == dt.datetime.now().date():
user_guess = guesses.guess
user_score = guesses.score
bot.send_message(chat_id=int(element), text="Todays challenge is over!\n"\ bot.send_message(chat_id=int(element), text="Todays challenge is over!\n"\
"The correct price is: " + str(product_today.price) + "\n"\ "The correct price is: " + str(product_today.price) + "\n"\
"Your guess was: " + str(user_guess) + "\n"\
"Your score was: " + str(user_score) + "\n"\
"Check the /scoreboard to see the leaderboard!") "Check the /scoreboard to see the leaderboard!")
else: else:
sys.exit(-1) sys.exit(-1)