Remove Emrah's training_record_fix.py

member_id is only a hint from the old portal scrape import used to
link objects when people register on Spaceport if they had an account on
the old portal. It shouldn't be used going forward.
This commit is contained in:
Tanner Collin 2020-06-05 03:10:07 +00:00
parent 8e9855c408
commit 86f4862dbe

View File

@ -1,25 +0,0 @@
import django, sys, os
os.environ['DJANGO_SETTINGS_MODULE'] = 'apiserver.settings'
django.setup()
import datetime
import json
from apiserver.api import models, utils
sessions = models.Session.objects.all()
for session in sessions:
print("ID: {}".format(session.id))
students = models.Training.objects.filter(session = session)
for student in students:
if not student.user and student.member_id:
member = models.Member.objects.get(pk=student.member_id)
student.user = member.user
student.save()
if student.user and not student.member_id:
member = models.Member.objects.get(user=student.user)
student.member_id = member.id
student.save()
print("\tStudent: {} ({})".format(student.user,student.member_id))
print('Done.')