Correct timezone for date in lockout auth update script
This commit is contained in:
parent
9ad64cbf5a
commit
2656ed3ff0
|
@ -4,6 +4,7 @@ django.setup()
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
|
from django.utils.timezone import now, pytz
|
||||||
from apiserver.api import models, utils
|
from apiserver.api import models, utils
|
||||||
|
|
||||||
# Member orientation
|
# Member orientation
|
||||||
|
@ -25,7 +26,7 @@ for session in sessions:
|
||||||
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
|
member.orientation_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date()
|
||||||
member.save()
|
member.save()
|
||||||
|
|
||||||
# Lathe
|
# Lathe
|
||||||
|
@ -38,7 +39,7 @@ for session in sessions:
|
||||||
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
|
member.lathe_cert_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date()
|
||||||
member.save()
|
member.save()
|
||||||
|
|
||||||
# Manual Mill
|
# Manual Mill
|
||||||
|
@ -51,7 +52,7 @@ for session in sessions:
|
||||||
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
|
member.mill_cert_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date()
|
||||||
member.save()
|
member.save()
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,7 +66,7 @@ for session in sessions:
|
||||||
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
|
member.wood_cert_date = session.datetime.astimezone(pytz.timezone('America/Edmonton')).date()
|
||||||
member.save()
|
member.save()
|
||||||
|
|
||||||
print('Done.')
|
print('Done.')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user