Skip to content

Commit

Permalink
Avoid keyError
Browse files Browse the repository at this point in the history
  • Loading branch information
ipdae committed Sep 24, 2024
1 parent 347fbb1 commit 224ae37
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions world_boss/app/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,11 @@ def insert_world_boss_rewards(rows: List[RecipientRow], signer_address: str):
values = []
for reward in result:
exist_tickers = [i.ticker for i in reward.amounts]
for amounts in world_boss_reward_amounts[reward.ranking]:
if amounts["ticker"] not in exist_tickers:
amounts["reward_id"] = reward.id
values.append(amounts)
if world_boss_rewards.get(reward.ranking):
for amounts in world_boss_reward_amounts[reward.ranking]:
if amounts["ticker"] not in exist_tickers:
amounts["reward_id"] = reward.id
values.append(amounts)
if values:
db.execute(insert(WorldBossRewardAmount), values)
db.commit()
Expand Down

0 comments on commit 224ae37

Please sign in to comment.