Add Woodworking-2 and CNC tool certification
This commit is contained in:
parent
655a13547a
commit
9fa6210345
|
@ -51,6 +51,8 @@ class Member(models.Model):
|
||||||
lathe_cert_date = models.DateField(blank=True, null=True, default=None)
|
lathe_cert_date = models.DateField(blank=True, null=True, default=None)
|
||||||
mill_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)
|
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)
|
paused_date = models.DateField(blank=True, null=True)
|
||||||
monthly_fees = models.IntegerField(default=55, blank=True, null=True)
|
monthly_fees = models.IntegerField(default=55, blank=True, null=True)
|
||||||
|
|
||||||
|
|
|
@ -142,6 +142,8 @@ class MemberSerializer(serializers.ModelSerializer):
|
||||||
'lathe_cert_date',
|
'lathe_cert_date',
|
||||||
'mill_cert_date',
|
'mill_cert_date',
|
||||||
'wood_cert_date',
|
'wood_cert_date',
|
||||||
|
'wood2_cert_date',
|
||||||
|
'cnc_cert_date',
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_status(self, obj):
|
def get_status(self, obj):
|
||||||
|
|
|
@ -376,10 +376,14 @@ class LockoutViewSet(viewsets.ViewSet, List):
|
||||||
if member.paused_date: continue
|
if member.paused_date: continue
|
||||||
|
|
||||||
authorization = {}
|
authorization = {}
|
||||||
|
authorization['id'] = member.id
|
||||||
|
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)
|
||||||
authorization['wood'] = bool(member.wood_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
|
active_member_cards[card.card_number] = authorization
|
||||||
|
|
||||||
|
|
|
@ -69,4 +69,29 @@ for session in sessions:
|
||||||
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
|
||||||
|
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.')
|
print('Done.')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user