From 59aaa672c1c13359b56302ab2f344de8ec2fc71d Mon Sep 17 00:00:00 2001 From: Yannik Schmidt Date: Tue, 29 Sep 2020 07:56:29 +0200 Subject: [PATCH] minor fixes --- Round.py | 18 +++++++++++++++--- database.py | 7 ++----- templates/rounds.html | 4 ++++ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/Round.py b/Round.py index 6ed3fce..e4c9e4b 100644 --- a/Round.py +++ b/Round.py @@ -15,8 +15,20 @@ class Round: self.losers = losers self.winnerSide = winnerSide if winnerSide == 2: - self.winnerSideString = "Insurgent" - else: self.winnerSideString = "Security" - self.mapName = mapName + self.loserSideString = "Insurgent" + else: + self.winnerSideString = "Insurgent" + self.loserSideString = "Security" + if mapName: + self.mapName = mapName + else: + self.mapName = "unavailiable" self.duration = datetime.timedelta(seconds=int(duration)) + if prediction == 0: + self.prediction = self.winnerSideString + elif prediction == 1: + self.prediction = self.loserSideString + else: + self.prediction = "Error" + self.confidence = int(confidence * 100) diff --git a/database.py b/database.py index ac1ec97..cbb2e53 100644 --- a/database.py +++ b/database.py @@ -126,12 +126,9 @@ class DatabaseConnection: '''Get rounds played between two times''' cursor = self.connRounds.cursor() - cursor.execute('''SELECT * FROM rounds WHERE timestamp between ? and ?''', - (start.timestamp(), end.timestamp())) + cursor.execute('''SELECT * FROM rounds WHERE timestamp between ? and ? + order by timestamp DESC''', (start.timestamp(), end.timestamp())) - print('''SELECT * FROM rounds WHERE timestamp between {} and {}'''.format( - start.timestamp(), end.timestamp())) - rounds = [] for row in cursor: rounds += [Round.Round(row)] diff --git a/templates/rounds.html b/templates/rounds.html index 35b4b5c..e398969 100644 --- a/templates/rounds.html +++ b/templates/rounds.html @@ -33,6 +33,8 @@ Winner Duration Start Time + Rating System Winner Prediction + Confidence @@ -42,6 +44,8 @@ {{ r.winnerSideString }} {{ r.duration }} {{ r.startTime.strftime('%H:%M %d.%m.%Y') }} + {{ r.prediction }} + {{ r.confidence }}% {% endfor %}