Skip to content

Commit

Permalink
Fix class imports that lead to crash
Browse files Browse the repository at this point in the history
  • Loading branch information
kbublitz committed Mar 20, 2019
1 parent 44d0300 commit f57497f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
27 changes: 14 additions & 13 deletions src/database/database.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

import sqlite3
from kicker import player
from kicker import Game
from kicker.game import Game
from kicker.player import Player
import trueskill
import os.path

Expand Down Expand Up @@ -99,7 +100,7 @@ def get_all_players(self):
cur = self.database.cursor()
cur.execute("SELECT * FROM players ORDER BY skill_mu DESC, skill_sigma ASC")
return [self.create_player(p) for p in cur.fetchall()]

def get_active_players(self):
cur = self.database.cursor()
cur.execute("SELECT * FROM players WHERE is_hidden=0 ORDER BY skill_mu DESC, skill_sigma ASC")
Expand All @@ -125,7 +126,7 @@ def update_player_skill(self, p):
self.database.commit()

def create_player(self, db_result):
p = player.Player()
p = Player()
p.id = db_result[0]
p.name = db_result[1]
p.tokenID = db_result[2]
Expand Down Expand Up @@ -174,27 +175,27 @@ def get_games(self, number=None):

games = []
for entry in cur:
game = Game.Game()
game = Game()
game.time = entry[0]
try:
game.player1 = self.get_player(entry[1])
except:
game.player1 = player.Player()
game.player1 = Player()
game.player1.name = "Unregistered Player"
try:
game.player2 = self.get_player(entry[2])
except:
game.player2 = player.Player()
game.player2 = Player()
game.player2.name = "Unregistered Player"
try:
game.player3 = self.get_player(entry[3])
except:
game.player3 = player.Player()
game.player3 = Player()
game.player3.name = "Unregistered Player"
try:
game.player4 = self.get_player(entry[4])
except:
game.player4 = player.Player()
game.player4 = Player()
game.player4.name = "Unregistered Player"
game.scoreTeam1 = entry[5]
game.scoreTeam2 = entry[6]
Expand All @@ -221,27 +222,27 @@ def get_game(self, game_id):
if result is None:
return None

game = Game.Game()
game = Game()
game.time = result[0]
try:
game.player1 = self.get_player(result[1])
except:
game.player1 = player.Player()
game.player1 = Player()
game.player1.name = "Unregistered Player"
try:
game.player2 = self.get_player(result[2])
except:
game.player2 = player.Player()
game.player2 = Player()
game.player2.name = "Unregistered Player"
try:
game.player3 = self.get_player(result[3])
except:
game.player3 = player.Player()
game.player3 = Player()
game.player3.name = "Unregistered Player"
try:
game.player4 = self.get_player(result[4])
except:
game.player4 = player.Player()
game.player4 = Player()
game.player4.name = "Unregistered Player"
game.scoreTeam1 = result[5]
game.scoreTeam2 = result[6]
Expand Down
3 changes: 2 additions & 1 deletion src/gui/kickerapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import config
from config import db, rfidReader
from kicker.game import Game

import kivy
kivy.require('1.10.0')
Expand Down Expand Up @@ -226,7 +227,7 @@ def on_confirm(self, sender):
winner_team = 1
else:
winner_team = 2
game = Game.Game()
game = Game()
game.player1 = self.players[0]
game.player2 = self.players[1]
game.player3 = self.players[2]
Expand Down

0 comments on commit f57497f

Please sign in to comment.