uberfastman / fantasy-football-metrics-weekly-report

Command line application to create weekly reports (containing stats, metrics, and rankings) for Fantasy Football leagues on the following platforms: Yahoo, ESPN, CBS, Sleeper, Fleaflicker
GNU General Public License v3.0
202 stars 49 forks source link

[Bug] fleaflicker.py fails when league has no playoffs #146

Closed dave7734 closed 1 year ago

dave7734 commented 3 years ago

Description of Issue

Fleaflicker.py test for Playoffs has error when there are no playoffs the int(elements[elements.index(elem) + 1] has "No playoffs" thus is not an int fails in self.num_playoff_slots = int(elements[elements.index(elem) + 1].span.text.strip()) AttributeError: 'NoneType' object has no attribute 'text'

Additional Information as Applicable

printed out the values (thus the line numbers are slightly off from your code) elem Playoffs elem strip Playoffs elem indx +1

No playoffs
Traceback (most recent call last): File "main.py", line 273, in report = select_league( File "main.py", line 162, in select_league return FantasyFootballReport(week_for_report=week_for_report, File "/app/report/builder.py", line 108, in init self.league = league_data_factory( File "/app/utils/report_tools.py", line 461, in league_data_factory fleaflicker_league = FleaflickerLeagueData( File "/app/dao/platforms/fleaflicker.py", line 92, in init self.num_playoff_slots = int(elements[elements.index(elem) + 1].span.text.strip()) AttributeError: 'NoneType' object has no attribute 'text'

Fantasy Football Platform

Yahoo/ESPN/Sleeper/Fleaflicker

League ID

XXXXXX...

9959

Operating System

macOS/Windows/Linux

Windows 10

Other

Any other setup/environment/configuration information you might deem potentially relevant.

uberfastman commented 1 year ago

@dave7734 while I recognize that addressing this bug is very late, I appreciate you reporting it nonetheless. It has been addressed in #188.