fix: use min_rarity/max_rarity for exact rarity targeting
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m27s
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m27s
The players/random API endpoint only accepts min_rarity and max_rarity, not rarity. The previous fix silently did nothing because FastAPI ignores unknown query parameters. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
08a639ec54
commit
55a3255b35
@ -1500,13 +1500,13 @@ class Economy(commands.Cog):
|
||||
team_infielders = []
|
||||
for pos in ["C", "1B", "2B", "3B", "SS"]:
|
||||
if roster_counts["Replacement"] < roster_counts["Reserve"]:
|
||||
rarity_param = ("rarity", 0)
|
||||
rarity_params = [("min_rarity", 0), ("max_rarity", 0)]
|
||||
else:
|
||||
rarity_param = ("rarity", 1)
|
||||
rarity_params = [("min_rarity", 1), ("max_rarity", 1)]
|
||||
|
||||
r_draw = await db_get(
|
||||
"players/random",
|
||||
params=[("pos_include", pos), rarity_param, ("limit", 2)],
|
||||
params=[("pos_include", pos), *rarity_params, ("limit", 2)],
|
||||
none_okay=False,
|
||||
)
|
||||
team_infielders.extend(r_draw["players"])
|
||||
@ -1531,13 +1531,13 @@ class Economy(commands.Cog):
|
||||
team_outfielders = []
|
||||
for pos in ["LF", "CF", "RF"]:
|
||||
if roster_counts["Replacement"] < roster_counts["Reserve"]:
|
||||
rarity_param = ("rarity", 0)
|
||||
rarity_params = [("min_rarity", 0), ("max_rarity", 0)]
|
||||
else:
|
||||
rarity_param = ("rarity", 1)
|
||||
rarity_params = [("min_rarity", 1), ("max_rarity", 1)]
|
||||
|
||||
r_draw = await db_get(
|
||||
"players/random",
|
||||
params=[("pos_include", pos), rarity_param, ("limit", 2)],
|
||||
params=[("pos_include", pos), *rarity_params, ("limit", 2)],
|
||||
none_okay=False,
|
||||
)
|
||||
team_outfielders.extend(r_draw["players"])
|
||||
|
||||
@ -378,13 +378,13 @@ class TeamSetup(commands.Cog):
|
||||
team_infielders = []
|
||||
for pos in ["C", "1B", "2B", "3B", "SS"]:
|
||||
if roster_counts["Replacement"] < roster_counts["Reserve"]:
|
||||
rarity_param = ("rarity", 0)
|
||||
rarity_params = [("min_rarity", 0), ("max_rarity", 0)]
|
||||
else:
|
||||
rarity_param = ("rarity", 1)
|
||||
rarity_params = [("min_rarity", 1), ("max_rarity", 1)]
|
||||
|
||||
r_draw = await db_get(
|
||||
"players/random",
|
||||
params=[("pos_include", pos), rarity_param, ("limit", 2)],
|
||||
params=[("pos_include", pos), *rarity_params, ("limit", 2)],
|
||||
none_okay=False,
|
||||
)
|
||||
team_infielders.extend(r_draw["players"])
|
||||
@ -409,13 +409,13 @@ class TeamSetup(commands.Cog):
|
||||
team_outfielders = []
|
||||
for pos in ["LF", "CF", "RF"]:
|
||||
if roster_counts["Replacement"] < roster_counts["Reserve"]:
|
||||
rarity_param = ("rarity", 0)
|
||||
rarity_params = [("min_rarity", 0), ("max_rarity", 0)]
|
||||
else:
|
||||
rarity_param = ("rarity", 1)
|
||||
rarity_params = [("min_rarity", 1), ("max_rarity", 1)]
|
||||
|
||||
r_draw = await db_get(
|
||||
"players/random",
|
||||
params=[("pos_include", pos), rarity_param, ("limit", 2)],
|
||||
params=[("pos_include", pos), *rarity_params, ("limit", 2)],
|
||||
none_okay=False,
|
||||
)
|
||||
team_outfielders.extend(r_draw["players"])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user