def get(self, team1query, team2query): team1id = HotFuzzTeam(team1query)[2] team2id = HotFuzzTeam(team2query)[2] pie1 = TeamPIE(team1id) pie2 = TeamPIE(team2id) if pie1 == pie2: winner = 'TIE' elif pie1 > pie2: winner = teamdict[team1id] else: winner = teamdict[team2id] return jsonify({'Winner is the '+winner: {teamdict[team1id]: pie1, teamdict[team2id]: pie2}})
def get(self, playerguess): playername = extractOne(playerguess, playerdict)[0] data = fixer([d.__dict__ for d in Players.query.filter_by(PLAYER_NAME=playername)]) return jsonify({playername: data})
def get(self, teamid): if teamid not in teamdict: return jsonify({'ERROR': 'ID NOT FOUND'}) else: data = PlayersInTeam(teamid) return jsonify({teamdict[teamid]: data})
def get(self, teamguess): teamname = extractOne(teamguess, teamdict)[0] data = fixer([d.__dict__ for d in Teams.query.filter_by(TEAM_NAME=teamname)]) return jsonify({teamname: data})
def get(self, playerid): if playerid not in playerdict: return jsonify({'ERROR': 'ID NOT FOUND'}) else: data = fixer([d.__dict__ for d in Players.query.filter_by(PLAYER_ID=playerid)]) return jsonify({'Player ID Result': data})
def get(self, teamid): if teamid not in teamdict: return jsonify({'ERROR': 'ID NOT FOUND'}) else: data = fixer([d.__dict__ for d in Teams.query.filter_by(TEAM_ID=teamid)]) return jsonify({'Team ID Result': data})
def get(self): players = fixer([p.__dict__ for p in Players.query.all()]) return jsonify({'NBA Players': players})
def get(self): teams = fixer([t.__dict__ for t in Teams.query.all()]) return jsonify({'NBA Teams': teams})