This commit is contained in:
fingadumbledore 2023-05-06 10:57:42 +02:00
parent c6cb5eaf72
commit 2b4f1b2929
3 changed files with 35 additions and 27 deletions

8
mate.py Normal file
View File

@ -0,0 +1,8 @@
# mws = matewirtschaftssystem
def mws():
print("Mate")
def materechner():
print("eine Mate haha")

View File

@ -42,32 +42,5 @@ def picker(gamefile, session_id, spieler_id):
shutil.move(gamefile, session_id)
def create_chart(session_id,spiel_name):
""" create chart of game """
con = sqlite3.connect("party.db")
cur = con.cursor()
dateiname = session_id + spiel_name + ".png"
try:
l = f"SELECT 'username' FROM user INNER JOIN game ON game.userID = user.userID;"
user = [i[0] for i in cur.execute(l).fetchall()]
except:
print("Fehler beim Ausführen von:" + l)
try:
l = f"""SELECT ZEIT
FROM game
WHERE sessionID = \'{session_id}\' AND Spielname = \'{spiel_name}\';"""
zeit = [i[0] for i in cur.execute(l).fetchall()]
except:
print("Fehler beim Ausführen von:" + l)
colors = ['green','blue','purple','brown','teal', 'yellow', 'black', 'orange']
plt.bar(user, zeit, color=colors)
plt.title(spiel_name, fontsize=14)
plt.xlabel('User', fontsize=14)
plt.ylabel('Zeit in Sekunden', fontsize=14)
plt.grid(False)
plt.savefig(dateiname)
if __name__ == "__main__":
print("Use main.py to use program")

27
statistik.py Normal file
View File

@ -0,0 +1,27 @@
import matplotlib.pyplot as plt
def create_chart(session_id,spiel_name):
""" create chart of game """
con = sqlite3.connect("party.db")
cur = con.cursor()
dateiname = session_id + spiel_name + ".png"
try:
l = f"SELECT 'username' FROM user INNER JOIN game ON game.userID = user.userID;"
user = [i[0] for i in cur.execute(l).fetchall()]
except:
print("Fehler beim Ausführen von:" + l)
try:
l = f"""SELECT ZEIT
FROM game
WHERE sessionID = \'{session_id}\' AND Spielname = \'{spiel_name}\';"""
zeit = [i[0] for i in cur.execute(l).fetchall()]
except:
print("Fehler beim Ausführen von:" + l)
colors = ['green','blue','purple','brown','teal', 'yellow', 'black', 'orange']
plt.bar(user, zeit, color=colors)
plt.title(spiel_name, fontsize=14)
plt.xlabel('User', fontsize=14)
plt.ylabel('Zeit in Sekunden', fontsize=14)
plt.grid(False)
plt.savefig(dateiname)