Skip to content

Commit

Permalink
make sentry happy
Browse files Browse the repository at this point in the history
  • Loading branch information
spookybear0 committed Mar 25, 2024
1 parent 0e16ca1 commit 9a9d8a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions helpers/adminhelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ async def delete_player_from_game(game: Union[SM5Game, LaserballGame], codename:

# go through all events and delete them

if entity_start is None:
return

async for event in game.events:
arguments = event.arguments
for info in arguments:
Expand All @@ -139,19 +142,19 @@ async def delete_player_from_game(game: Union[SM5Game, LaserballGame], codename:

logger.debug("Deleting sm5stats")

id_ = (await SM5Stats.filter(entity__entity_id=entity_start.entity_id).first()).id
sm5_stats = (await SM5Stats.filter(entity__entity_id=entity_start.entity_id).first())
try:
await SM5Stats.filter(id=id_).delete()
await SM5Stats.filter(id=sm5_stats.id).delete()
except Exception:
logger.warning("Failed to delete sm5stats, continuing")
elif mode == "laserball":
# delete laserballstats

logger.debug("Deleting laserballstats")

id_ = (await LaserballGame.filter(entity__entity_id=entity_start.entity_id).first()).id
sm5_stats = (await LaserballGame.filter(entity__entity_id=entity_start.entity_id).first())
try:
await LaserballGame.filter(id=id_).delete()
await LaserballGame.filter(id=sm5_stats.id).delete()
except Exception:
logger.warning("Failed to delete laserballstats, continuing")
else:
Expand Down
4 changes: 2 additions & 2 deletions helpers/tdfhelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,13 @@ async def parse_sm5_game(file_location: str) -> SM5Game:
# update player name if we have a new one and we have entity_id
elif await Player.filter(entity_id=e.entity_id).exists() and (await Player.filter(entity_id=e.entity_id).first()).codename != e.name:
player = await Player.filter(entity_id=e.entity_id).first()
player.name = e.name
player.codename = e.name
player.player_id = db_member_id
await player.save()
# update player_id if we have entity_id and don't have player_id
elif await Player.filter(entity_id=e.entity_id).exists() and (await Player.filter(entity_id=e.entity_id).first()).player_id == "":
player = await Player.filter(entity_id=e.entity_id).first()
player.player_id = member_id
player.player_id = db_member_id
await player.save()
# create new player if we don't have a name or entity_id
elif not await Player.filter(codename=e.name).exists() and not await Player.filter(entity_id=e.entity_id).exists():
Expand Down

0 comments on commit 9a9d8a2

Please sign in to comment.