def loadPlayer(self,playerRfid): if len(self.playersTeamA) + len(self.playersTeamB) >= 8: self.setLayout("error") self.invokeLayoutFunction("updateErrorMessage","Max 8 players") self.send("lpc",{"head":'get_tag'}) return player = Player.createOrLoad(playerRfid, self.session) if player not in self.playersTeamA and player not in self.playersTeamB: if(len(self.playersTeamB) < len(self.playersTeamA)): self.playersTeamB.append(player) else: self.playersTeamA.append(player) self.send("lpc",{"head":'get_tag'}) self.setLayout("match_setup") self.updateLayout()
def testPlayerCreateOrLoadDifferent(self): playerA = Player.createOrLoad('1',self.session) self.session.commit() playerB = Player.createOrLoad('2',self.session) self.assertNotEqual(playerA,playerB)
def profile_data() -> Profile: return Profile( Player(**summary_data()["response"]["players"][0]), [Game(**game) for game in player_data()["response"]["games"]], )
def testPlayerCreateOrLoadSame(self): playerA = Player.createOrLoad('1',self.session) self.session.commit() playerB = Player.createOrLoad('1',self.session) self.assertEqual(playerA,playerB)
async def find_user_summary(user_id: str) -> Player: result = await client_fetch("/ISteamUser/GetPlayerSummaries/v2/", {"steamids": user_id}) return Player(**result["response"]["players"][0])