fix: add missing week field to scout reward POST
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m22s
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m22s
The rewards API requires a week field. The scout claim callback was posting without it, causing a 422 validation error when a user selected a card from a scout opportunity. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1c3ef0935e
commit
c875cee9ee
@ -11,7 +11,7 @@ import logging
|
|||||||
|
|
||||||
import discord
|
import discord
|
||||||
|
|
||||||
from api_calls import db_post
|
from api_calls import db_get, db_post
|
||||||
from helpers.main import get_team_by_owner, get_card_embeds
|
from helpers.main import get_team_by_owner, get_card_embeds
|
||||||
from helpers.scouting import (
|
from helpers.scouting import (
|
||||||
SCOUT_TOKENS_PER_DAY,
|
SCOUT_TOKENS_PER_DAY,
|
||||||
@ -207,12 +207,14 @@ class ScoutButton(discord.ui.Button):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Consume a scout token
|
# Consume a scout token
|
||||||
|
current = await db_get("current")
|
||||||
await db_post(
|
await db_post(
|
||||||
"rewards",
|
"rewards",
|
||||||
payload={
|
payload={
|
||||||
"name": "Scout Token",
|
"name": "Scout Token",
|
||||||
"team_id": scouter_team["id"],
|
"team_id": scouter_team["id"],
|
||||||
"season": PD_SEASON,
|
"season": PD_SEASON,
|
||||||
|
"week": current["week"],
|
||||||
"created": int_timestamp(),
|
"created": int_timestamp(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
@ -210,12 +210,14 @@ class TestScoutButtonSuccess:
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
@patch("discord_ui.scout_view.get_card_embeds", new_callable=AsyncMock)
|
@patch("discord_ui.scout_view.get_card_embeds", new_callable=AsyncMock)
|
||||||
@patch("discord_ui.scout_view.db_post", new_callable=AsyncMock)
|
@patch("discord_ui.scout_view.db_post", new_callable=AsyncMock)
|
||||||
|
@patch("discord_ui.scout_view.db_get", new_callable=AsyncMock)
|
||||||
@patch("discord_ui.scout_view.get_scout_tokens_used", new_callable=AsyncMock)
|
@patch("discord_ui.scout_view.get_scout_tokens_used", new_callable=AsyncMock)
|
||||||
@patch("discord_ui.scout_view.get_team_by_owner", new_callable=AsyncMock)
|
@patch("discord_ui.scout_view.get_team_by_owner", new_callable=AsyncMock)
|
||||||
async def test_successful_scout_creates_card_copy(
|
async def test_successful_scout_creates_card_copy(
|
||||||
self,
|
self,
|
||||||
mock_get_team,
|
mock_get_team,
|
||||||
mock_get_tokens,
|
mock_get_tokens,
|
||||||
|
mock_db_get,
|
||||||
mock_db_post,
|
mock_db_post,
|
||||||
mock_card_embeds,
|
mock_card_embeds,
|
||||||
sample_cards,
|
sample_cards,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user