Skip to content

Commit

Permalink
Merge pull request #118 from DesiPilla/minor-fixes
Browse files Browse the repository at this point in the history
fix: Only send email alerts for new leagues
  • Loading branch information
DesiPilla authored Oct 22, 2024
2 parents 758656e + 0e6f709 commit c29d0d1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions fantasy_stats/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ def league_input(request):
if league_info_objs:
league_info = league_info_objs[0]
league_obj = fetch_league(league_id, league_year, swid, espn_s2)
print("League found!")
print(
"League {} ({}) already exists in the database.".format(
league_id, league_year
)
)

else:
print(
Expand All @@ -106,6 +110,10 @@ def league_input(request):
league_id, league_year
)
)

# Send an email notification that a new league has been added
send_new_league_added_alert(league_info)

except espn_api.requests.espn_requests.ESPNInvalidLeague as e:
print(
"League {} ({}) NOT FOUND! ESPN returned an error: {}".format(
Expand Down Expand Up @@ -173,9 +181,6 @@ def league_input(request):
)
)

# Send an email notification that a new league has been added
send_new_league_added_alert(league_info)

if league_obj.currentMatchupPeriod <= league_obj.firstScoringPeriod:
# If the league hasn't started yet, display the "too soon" page
return HttpResponse(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "doritostats"
version = "3.4.18"
version = "3.4.19"
description = "This project aims to make ESPN Fantasy Football statistics easily available. With the introduction of version 3 of the ESPN's API, this structure creates leagues, teams, and player classes that allow for advanced data analytics and the potential for many new features to be added."
authors = ["Desi Pilla <[email protected]>"]
license = "https://github.com/DesiPilla/espn-api-v3/blob/master/LICENSE"
Expand Down

0 comments on commit c29d0d1

Please sign in to comment.