Example #1
0
class Upcoming_Match(db.Model):
	uuid = db.Column(db.String(512), primary_key=True)
	team1 = db.Column(db.String(120), nullable=False)
	team2 = db.Column(db.String(120), nullable=False)
	date = db.Column(db.String(50), nullable=False)

	def __repr__(self):
		return self.team1 + " vs " + self.team2
Example #2
0
class Match(db.Model):
	id = db.Column(db.Integer, primary_key=True)

	first_team_id = db.Column(db.Integer, db.ForeignKey('team.id'), nullable=False)
	first_team = db.relationship("Team", foreign_keys=[first_team_id])
	
	first_team_score = db.Column(db.Integer, nullable=False)

	second_team_id = db.Column(db.Integer, db.ForeignKey('team.id'), nullable=False)
	second_team = db.relationship("Team", foreign_keys=[second_team_id])

	second_team_score = db.Column(db.Integer, nullable=False)
	team1_pos = db.Column(db.String(5))
	team2_pos = db.Column(db.String(5))
	date = db.Column(db.String(120), nullable=False)
	players_stats = db.relationship("Match_Player_Stats", backref='match', lazy=True)



	def team_won(self):
		if self.first_team_score > self.second_team_score:
			return self.first_team
		elif self.first_team_score < self.second_team_score:
			return self.second_team
		else:
			return "Draw"




 
	def __repr__(self):
		return f"{self.first_team} {self.first_team_score} - {self.second_team_score} {self.second_team}"
Example #3
0
class Player(db.Model):
	id = db.Column(db.Integer, primary_key=True)
	name = db.Column(db.String(120), nullable=False)
	
	age = db.Column(db.Integer, nullable=False)
	nationality = db.Column(db.String(120), nullable=False)
	shirt_number = db.Column(db.String(5))
	total_matches = db.Column(db.Integer)
	total_goals = db.Column(db.Integer)
	total_assists = db.Column(db.Integer)
	team_id = db.Column(db.Integer, db.ForeignKey('team.id'), nullable=False)
	games_stats = db.relationship('Match_Player_Stats', backref='player', lazy=True)

	def __repr__(self):
		return f"{self.name}"
Example #4
0
class Team(db.Model):
	id = db.Column(db.Integer, primary_key=True)
	name = db.Column(db.String(120), nullable=False)
	points = db.Column(db.Integer, nullable=False)
	wins = db.Column(db.Integer, nullable=False)
	draws = db.Column(db.Integer, nullable=False)
	loses = db.Column(db.Integer, nullable=False)
	goals_scored = db.Column(db.Integer, nullable=False)
	goals_concended = db.Column(db.Integer, nullable=False)
	short_name = db.Column(db.String(10), nullable=False)
	nickname = db.Column(db.String(120), nullable=False)
	players = db.relationship("Player", backref="team", lazy=True)
	

	def last_five(self):
		
		matches = Match.query.filter(or_(Match.first_team_id == self.id, Match.second_team_id == self.id)).all()[-5:]
		return matches



	def __repr__(self):
		return f"{self.name}"
Example #5
0
class Match_Player_Stats(db.Model):
	id = db.Column(db.Integer, primary_key=True)
	match_id = db.Column(db.Integer, db.ForeignKey('match.id'), nullable=False)
	player_id = db.Column(db.Integer, db.ForeignKey('player.id'), nullable=False)
	goals = db.Column(db.Integer, nullable=False)
	assists = db.Column(db.Integer, nullable=False)
	red_cards = db.Column(db.Integer, nullable=False)
	yellow_cards = db.Column(db.Integer, nullable=False)
	minutes_played = db.Column(db.Integer, nullable=False)
	pens_made = db.Column(db.Integer, nullable=False)
	pens_att = db.Column(db.Integer, nullable=False)
	total_shots = db.Column(db.Integer, nullable=False)
	shots_on_target = db.Column(db.Integer, nullable=False)
	touches = db.Column(db.Integer, nullable=False)
	pressures = db.Column(db.Integer, nullable=False)
	tackles = db.Column(db.Integer, nullable=False)
	interceptions = db.Column(db.Integer, nullable=False)
	blocks = db.Column(db.Integer, nullable=False)
	passes = db.Column(db.Integer, nullable=False)
	passes_completed = db.Column(db.Integer, nullable=False)
	passes_pct = db.Column(db.Integer, nullable=False)
	passes_progressive_distance = db.Column(db.Integer, nullable=False)
	carries = db.Column(db.Integer, nullable=False)
	carry_progressive_distance = db.Column(db.Integer, nullable=False)
	dribbles = db.Column(db.Integer, nullable=False)
	dribbles_completed = db.Column(db.Integer, nullable=False)

	def __repr__(self):
		return f"game ID {self.match_id} stats of player ID {self.player_id}"
Example #6
0
class Used_Link(db.Model):
	used_link = db.Column(db.String(1024), nullable=False, primary_key=True)
	def __repr__(self):
		return self.used_link