GrafeasGroup / blossom

The website. The app. The everything.
6 stars 3 forks source link

Add `migrate` slack command to move gamma between users #165

Closed itsthejoker closed 2 years ago

itsthejoker commented 3 years ago

Sometimes folks change accounts and gamma needs to be moved from one account to another. Since gamma is calculated by submissions completed, we should have a slack command that is something like blossom migrate old_username new_username. Actual code that needs to be run is below:

>>> from authentication.models import BlossomUser
>>> old = BlossomUser.objects.filter(username="TheGlibGlob").first()
>>> old
<BlossomUser: TheGlibGlob>
>>> new = B.objects.filter(username="JustAGlibGlob").first()
>>> new
<BlossomUser: JustAGlibGlob>
>>> from api.models import Transcription
>>> old_set = Transcription.objects.filter(author=old)
>>> old_set.count()
75
>>> for obj in old_set:
...   obj.submission.completed_by = new
...   obj.submission.save()
... 
>>> 
TimJentzsch commented 3 years ago

This is the same as #96 right? We can probably close on of those.