WeightliftingNZ / lifter-api

Access athlete and competition results for weightlifting.
https://lifter.shivan.xyz
MIT License
1 stars 1 forks source link

Athlete merge tool / API #41

Open ditorelo opened 1 year ago

ditorelo commented 1 year ago

There's A TON of duplicate athletes. At some point we'll have to clean it up, if would be great if we had an API or a Django tool where we merge two or more athletes (literally, associating all records with one of them and deleting the others)

shivan-s commented 1 year ago

I'll look into this.

At present moment, we would have to go into the lifts of the duplicated athlete and then change them to one of the "real" athletes.

I'm learning lots!

shivan-s commented 1 year ago

For @shivan-s reference: https://docs.djangoproject.com/en/4.1/ref/contrib/postgres/search/

ditorelo commented 1 year ago

I'm having a lot of issues on my imports around this. I might create a little script tool to do it, and will share once I do.

shivan-s commented 1 year ago

No worries. I was thinking about this.

Some things to get a head start on. The athlete detail view provides a list of lifts. So if you have a duplicated athlete you could get all the lift ids from that duplicated athletes. Then edit those lifts to move them to the 'real' athlete. Then, delete the duplicated athlete.

Just note that the delete is a cascade, so if you delete the athlete before moving the lifts, the lifts get deleted!!

I'm working on a fuzzy finder so before you create an athelete, it'll scan for similiarly named athletes. Hope this helps.