Fix quotes

This commit is contained in:
Tanner Collin 2020-08-11 21:01:27 +00:00
parent 35d62d6b7c
commit 7111ccb821
2 changed files with 14 additions and 13 deletions

View File

@ -377,7 +377,7 @@ class LockoutViewSet(viewsets.ViewSet, List):
authorization = {} authorization = {}
authorization['id'] = member.id 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['common'] = bool(member.orientation_date or member.vetted_date)
authorization['lathe'] = bool(member.lathe_cert_date) authorization['lathe'] = bool(member.lathe_cert_date)
authorization['mill'] = bool(member.mill_cert_date) authorization['mill'] = bool(member.mill_cert_date)

View File

@ -8,7 +8,7 @@ from django.utils.timezone import now, pytz
from apiserver.api import models, utils from apiserver.api import models, utils
# Member orientation # Member orientation
print("Updating member orientation dates") print('Updating member orientation dates')
sessions = models.Session.objects.filter(course = 249) sessions = models.Session.objects.filter(course = 249)
def get_member(obj): def get_member(obj):
@ -23,33 +23,33 @@ def get_member(obj):
for session in sessions: for session in sessions:
students = models.Training.objects.filter(session = session) students = models.Training.objects.filter(session = session)
for student in students: for student in students:
if student.attendance_status == "Attended": if student.attendance_status == 'Attended':
member = get_member(student) member = get_member(student)
if not member.orientation_date: if not member.orientation_date:
member.orientation_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date() member.orientation_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date()
member.save() member.save()
# Lathe # Lathe
print("Updating lathe training dates") print('Updating lathe training dates')
sessions = models.Session.objects.filter(course = 281) sessions = models.Session.objects.filter(course = 281)
for session in sessions: for session in sessions:
students = models.Training.objects.filter(session = session) students = models.Training.objects.filter(session = session)
for student in students: for student in students:
if student.attendance_status == "Attended": if student.attendance_status == 'Attended':
member = get_member(student) member = get_member(student)
if not member.lathe_cert_date: if not member.lathe_cert_date:
member.lathe_cert_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date() member.lathe_cert_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date()
member.save() member.save()
# Manual Mill # Manual Mill
print("Updating mill training dates") print('Updating mill training dates')
sessions = models.Session.objects.filter(course = 283) sessions = models.Session.objects.filter(course = 283)
for session in sessions: for session in sessions:
students = models.Training.objects.filter(session = session) students = models.Training.objects.filter(session = session)
for student in students: for student in students:
if student.attendance_status == "Attended": if student.attendance_status == 'Attended':
member = get_member(student) member = get_member(student)
if not member.mill_cert_date: if not member.mill_cert_date:
member.mill_cert_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date() member.mill_cert_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date()
@ -57,41 +57,42 @@ for session in sessions:
# Woodworking tools # Woodworking tools
print("Updating woodworking training dates") print('Updating woodworking training dates')
sessions = models.Session.objects.filter(course = 261) sessions = models.Session.objects.filter(course = 261)
for session in sessions: for session in sessions:
students = models.Training.objects.filter(session = session) students = models.Training.objects.filter(session = session)
for student in students: for student in students:
if student.attendance_status == "Attended": if student.attendance_status == 'Attended':
member = get_member(student) member = get_member(student)
if not member.wood_cert_date: if not member.wood_cert_date:
member.wood_cert_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date() member.wood_cert_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date()
member.save() member.save()
# Woodworking-2 tools # Woodworking-2 tools
print("Updating woodworking-2 training dates") print('Updating woodworking-2 training dates')
sessions = models.Session.objects.filter(course = 401) sessions = models.Session.objects.filter(course = 401)
for session in sessions: for session in sessions:
students = models.Training.objects.filter(session = session) students = models.Training.objects.filter(session = session)
for student in students: for student in students:
if student.attendance_status == "Attended": if student.attendance_status == 'Attended':
member = get_member(student) member = get_member(student)
if not member.wood2_cert_date: if not member.wood2_cert_date:
member.wood2_cert_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date() member.wood2_cert_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date()
member.save() member.save()
# CNC tools # CNC tools
print("Updating CNC training dates") print('Updating CNC training dates')
sessions = models.Session.objects.filter(course = 259) sessions = models.Session.objects.filter(course = 259)
for session in sessions: for session in sessions:
students = models.Training.objects.filter(session = session) students = models.Training.objects.filter(session = session)
for student in students: for student in students:
if student.attendance_status == "Attended": if student.attendance_status == 'Attended':
member = get_member(student) member = get_member(student)
if not member.cnc_cert_date: if not member.cnc_cert_date:
member.cnc_cert_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date() member.cnc_cert_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date()
member.save() member.save()
print('Done.') print('Done.')