Skip to content

Commit

Permalink
Fix teams reference
Browse files Browse the repository at this point in the history
  • Loading branch information
BenBrostoff committed Dec 27, 2023
1 parent 99fe856 commit d54fecc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion draftfast/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,4 +394,4 @@ def _set_min_teams(self):
)

if len(teams) > 0:
self.solver.Add(self.solver.Sum(teams) >= self.settings.min_teams)
self.solver.Add(self.solver.Sum(teams) >= self.min_teams)
6 changes: 4 additions & 2 deletions draftfast/test/test_optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,10 +718,13 @@ def test_no_opposing_def_dk_nfl_mock():
),
]

# relax min teams for simplified player pool
rules.DK_NFL_RULE_SET.min_teams = 1
# mock pool is constructed such that optimal lineup has qb opposing dst
roster = run(
rule_set=rules.DK_NFL_RULE_SET, player_pool=mock_pool, verbose=True
)
rules.DK_NFL_RULE_SET.min_teams = 3

assertions.assertEqual(roster.projected(), 909)
qb_team = roster.sorted_players()[0].team
Expand All @@ -738,7 +741,6 @@ def test_no_opposing_def_dk_nfl_mock():

assertions.assertEqual(roster, None)

# relax min teams
rules.DK_NFL_RULE_SET.min_teams = 1
roster = run(
rule_set=rules.DK_NFL_RULE_SET,
Expand All @@ -748,7 +750,6 @@ def test_no_opposing_def_dk_nfl_mock():
),
verbose=True,
)
rules.DK_NFL_RULE_SET.min_teams = 3

assertions.assertEqual(roster.projected(), 877)
assertions.assertEqual(len(set([p.team for p in roster.players])), 1)
Expand All @@ -770,6 +771,7 @@ def test_no_opposing_def_dk_nfl_mock():
if p.pos in rules.DK_NFL_RULE_SET.offensive_positions:
assertions.assertNotEqual(p.team, "X")

rules.DK_NFL_RULE_SET.min_teams = 3

def test_no_opposing_def_dk_nfl():
players = salary_download.generate_players_from_csvs(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setuptools.setup(
name='draftfast',
version='3.10.2',
version='3.10.3',
author='Ben Brostoff',
author_email='[email protected]',
description='A tool to automate and optimize DraftKings and FanDuel '
Expand Down

0 comments on commit d54fecc

Please sign in to comment.