Fix flashback cardset legality and rewards timestamp handling

- Add 2018 Promos (14) and 2022 Promos (4) to flashback mode legal cardsets
- Convert Unix timestamps to datetime in rewards POST/PATCH for PostgreSQL

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2026-01-30 15:08:21 -06:00
parent 23bf59e3db
commit 3dce457463
2 changed files with 9 additions and 4 deletions

View File

@ -69,9 +69,9 @@ CARDSETS = {
},
"hall-of-fame": {"primary": [x for x in range(1, 30)], "human": ranked_cardsets},
"flashback": {
"primary": [13, 5, 1, 3, 8], # 2018, 2019, 2021, 2022, Mario
"primary": [13, 14, 5, 1, 3, 4, 8], # 2018 + Promos, 2019, 2021, 2022 + Promos, Mario
"secondary": [24], # 2025
"human": [13, 5, 1, 3, 8], # 2018, 2019, 2021, 2022
"human": [13, 14, 5, 1, 3, 4, 8], # 2018 + Promos, 2019, 2021, 2022 + Promos
},
"gauntlet-3": {
"primary": [13], # 2018

View File

@ -112,7 +112,11 @@ async def post_rewards(reward: RewardModel, token: str = Depends(oauth2_scheme))
detail='You are not authorized to post rewards. This event has been logged.'
)
this_reward = Reward(**reward.dict())
reward_data = reward.dict()
# Convert milliseconds timestamp to datetime for PostgreSQL
if reward_data.get('created'):
reward_data['created'] = datetime.fromtimestamp(reward_data['created'] / 1000)
this_reward = Reward(**reward_data)
saved = this_reward.save()
if saved == 1:
@ -148,7 +152,8 @@ async def patch_reward(
if team_id is not None:
this_reward.team_id = team_id
if created is not None:
this_reward.created = created
# Convert milliseconds timestamp to datetime for PostgreSQL
this_reward.created = datetime.fromtimestamp(created / 1000)
if this_reward.save() == 1:
return_val = model_to_dict(this_reward)