fix(ingestion): stop fabricating missing player positions

This commit is contained in:
bisco
2026-04-11 00:54:19 +02:00
parent 677b5af40d
commit e6081428ae
5 changed files with 63 additions and 7 deletions

View File

@ -269,22 +269,16 @@ class LbaSerieAPublicImporter:
player = Player.objects.filter(pk=mapping.object_id).first()
if player is None:
raise ImportValidationError("Player mapping points to a missing record.")
position = player.position or Player.Position.SG
player.full_name = full_name
player.first_name = record["name"]
player.last_name = record["surname"]
player.position = position
player.save()
self.summary.players_updated += 1
else:
# LBA stats endpoint does not expose position directly. To satisfy the current
# required model field without guessing role/taxonomy data, we use a neutral
# default and keep role/specialty ownership untouched.
player = Player.objects.create(
full_name=full_name,
first_name=record["name"],
last_name=record["surname"],
position=Player.Position.SG,
)
self.summary.players_created += 1