diff --git a/apiserver/apiserver/api/views.py b/apiserver/apiserver/api/views.py index bdc7175..d8ae6b5 100644 --- a/apiserver/apiserver/api/views.py +++ b/apiserver/apiserver/api/views.py @@ -377,7 +377,7 @@ class LockoutViewSet(viewsets.ViewSet, List): authorization = {} authorization['id'] = member.id - authorization['name'] = member.first_name + " " + member.last_name + authorization['name'] = member.first_name + ' ' + member.last_name authorization['common'] = bool(member.orientation_date or member.vetted_date) authorization['lathe'] = bool(member.lathe_cert_date) authorization['mill'] = bool(member.mill_cert_date) diff --git a/apiserver/lockout_auth_update.py b/apiserver/lockout_auth_update.py index fc3f050..bc6d618 100644 --- a/apiserver/lockout_auth_update.py +++ b/apiserver/lockout_auth_update.py @@ -8,7 +8,7 @@ from django.utils.timezone import now, pytz from apiserver.api import models, utils # Member orientation -print("Updating member orientation dates") +print('Updating member orientation dates') sessions = models.Session.objects.filter(course = 249) def get_member(obj): @@ -23,33 +23,33 @@ def get_member(obj): for session in sessions: students = models.Training.objects.filter(session = session) for student in students: - if student.attendance_status == "Attended": + if student.attendance_status == 'Attended': member = get_member(student) if not member.orientation_date: member.orientation_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date() member.save() # Lathe -print("Updating lathe training dates") +print('Updating lathe training dates') sessions = models.Session.objects.filter(course = 281) for session in sessions: students = models.Training.objects.filter(session = session) for student in students: - if student.attendance_status == "Attended": + if student.attendance_status == 'Attended': member = get_member(student) if not member.lathe_cert_date: member.lathe_cert_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date() member.save() # Manual Mill -print("Updating mill training dates") +print('Updating mill training dates') sessions = models.Session.objects.filter(course = 283) for session in sessions: students = models.Training.objects.filter(session = session) for student in students: - if student.attendance_status == "Attended": + if student.attendance_status == 'Attended': member = get_member(student) if not member.mill_cert_date: member.mill_cert_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date() @@ -57,41 +57,42 @@ for session in sessions: # Woodworking tools -print("Updating woodworking training dates") +print('Updating woodworking training dates') sessions = models.Session.objects.filter(course = 261) for session in sessions: students = models.Training.objects.filter(session = session) for student in students: - if student.attendance_status == "Attended": + if student.attendance_status == 'Attended': member = get_member(student) if not member.wood_cert_date: member.wood_cert_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date() member.save() # Woodworking-2 tools -print("Updating woodworking-2 training dates") +print('Updating woodworking-2 training dates') sessions = models.Session.objects.filter(course = 401) for session in sessions: students = models.Training.objects.filter(session = session) for student in students: - if student.attendance_status == "Attended": + if student.attendance_status == 'Attended': member = get_member(student) if not member.wood2_cert_date: member.wood2_cert_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date() member.save() # CNC tools -print("Updating CNC training dates") +print('Updating CNC training dates') sessions = models.Session.objects.filter(course = 259) for session in sessions: students = models.Training.objects.filter(session = session) for student in students: - if student.attendance_status == "Attended": + if student.attendance_status == 'Attended': member = get_member(student) if not member.cnc_cert_date: member.cnc_cert_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date() member.save() + print('Done.')