Add Woodworking-2 and CNC tool certification

This commit is contained in:
Emrah Atil 2020-08-11 14:33:36 -06:00
parent 655a13547a
commit 9fa6210345
4 changed files with 33 additions and 0 deletions

View File

@ -51,6 +51,8 @@ class Member(models.Model):
lathe_cert_date = models.DateField(blank=True, null=True, default=None)
mill_cert_date = models.DateField(blank=True, null=True, default=None)
wood_cert_date = models.DateField(blank=True, null=True, default=None)
wood2_cert_date = models.DateField(blank=True, null=True, default=None)
cnc_cert_date = models.DateField(blank=True, null=True, default=None)
paused_date = models.DateField(blank=True, null=True)
monthly_fees = models.IntegerField(default=55, blank=True, null=True)

View File

@ -142,6 +142,8 @@ class MemberSerializer(serializers.ModelSerializer):
'lathe_cert_date',
'mill_cert_date',
'wood_cert_date',
'wood2_cert_date',
'cnc_cert_date',
]
def get_status(self, obj):

View File

@ -376,10 +376,14 @@ class LockoutViewSet(viewsets.ViewSet, List):
if member.paused_date: continue
authorization = {}
authorization['id'] = member.id
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)
authorization['wood'] = bool(member.wood_cert_date)
authorization['wood2'] = bool(member.wood2_cert_date)
authorization['cnc'] = bool(member.cnc_cert_date)
active_member_cards[card.card_number] = authorization

View File

@ -69,4 +69,29 @@ for session in sessions:
member.wood_cert_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date()
member.save()
# Woodworking-2 tools
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":
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")
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":
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.')