Skip to content

Commit

Permalink
add team owner keys
Browse files Browse the repository at this point in the history
  • Loading branch information
justin-hsieh committed Feb 5, 2024
1 parent b811148 commit 20f6e04
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,5 @@ key.json
.ipynb

db.ipynb
CREDS.json
CREDS.json
owners.py
21 changes: 17 additions & 4 deletions fantasy_app/scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from datetime import datetime
from dotenv import load_dotenv
from .espn_api_submodule.espn_api.football.league import League
from .owners import Teams

# load environment variables
load_dotenv()
Expand All @@ -23,6 +24,15 @@ def get_year():
def league_instance(input_year):
return League(league_id=LEAGUE_ID,year=input_year,espn_s2=ESPN_S2,swid=SWID)

'''
def team_names():
league = league_instance(get_year())
for i in league.teams:
#print(i.owners)
#print(i.team_name)
return
'''

def current_week():
league = league_instance(get_year())
return league.current_week
Expand Down Expand Up @@ -83,9 +93,11 @@ def get_most_position_points(position, stat, year, currentweek=0):
away = matchup.away_lineup
home = matchup.home_lineup

player_dict['team'] = matchup.away_team.team_name
player_dict1['team'] = matchup.home_team.team_name

player_dict['team_name'] = matchup.away_team.team_name
player_dict1['team_name'] = matchup.home_team.team_name
player_dict['team_owner'] = Teams[matchup.away_team.owners[0]]
player_dict1['team_owner'] = Teams[matchup.home_team.owners[0]]

away_dict = new_dict(
position, player_dict, away, stat, currentweek)
home_dict = new_dict(
Expand All @@ -106,4 +118,5 @@ def order_positions_by_points(score_list):

for i, member_dict in enumerate(sorted_list):
member_dict["rank"] = i + 1
return sorted_list
return sorted_list

0 comments on commit 20f6e04

Please sign in to comment.