Add rewards to more pages as we have support for them now
All checks were successful
Deploy to Server / deploy (push) Successful in 26s
All checks were successful
Deploy to Server / deploy (push) Successful in 26s
This commit is contained in:
parent
3535d7d2dd
commit
37c1390100
16 changed files with 966 additions and 216 deletions
|
|
@ -164,6 +164,7 @@ class V1GameDetailSchema(V1GameSchema):
|
|||
"""Twitch game detail response."""
|
||||
|
||||
campaigns: list[V1DropCampaignSummarySchema]
|
||||
reward_campaigns: list[V1RewardCampaignSchema]
|
||||
|
||||
|
||||
class V1ChannelDetailSchema(V1ChannelSchema):
|
||||
|
|
@ -642,6 +643,13 @@ def get_game(request: HttpRequest, twitch_id: str) -> V1GameDetailSchema:
|
|||
DropCampaign.objects.filter(game=game),
|
||||
).order_by("-end_at")
|
||||
now = timezone.now()
|
||||
reward_campaigns = list(
|
||||
RewardCampaign.objects
|
||||
.filter(game=game)
|
||||
.select_related("game")
|
||||
.prefetch_related("game__owners")
|
||||
.order_by("-starts_at"),
|
||||
)
|
||||
return V1GameDetailSchema(
|
||||
twitch_id=game.twitch_id,
|
||||
slug=game.slug,
|
||||
|
|
@ -659,6 +667,9 @@ def get_game(request: HttpRequest, twitch_id: str) -> V1GameDetailSchema:
|
|||
campaigns=[
|
||||
_serialize_campaign_summary(campaign, now) for campaign in campaigns
|
||||
],
|
||||
reward_campaigns=[
|
||||
_serialize_reward_campaign(rc, now) for rc in reward_campaigns
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue