[boardgames] Check if scrobble exists first

This commit is contained in:
2025-07-03 20:19:30 -04:00
parent 4924ef316f
commit 2c199c0e93
3 changed files with 22 additions and 8 deletions

View File

@ -445,7 +445,15 @@ def email_scrobble_board_game(
"log": log_data,
}
print(scrobble_dict)
scrobble = Scrobble.objects.filter(
board_game=base_game, user_id=user_id, timestamp=start
).first()
if scrobble:
logger.info(
"Scrobble already exists, skipping",
extra={"scrobble_dict": scrobble_dict, "user_id": user_id},
)
continue
scrobble = Scrobble.create_or_update(base_game, user_id, scrobble_dict)
scrobble.stop_timestamp = stop
scrobble.in_progress = False