From 9afa2fce32dfd90e6f8b662354bbf99f97fc844d Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Thu, 12 Aug 2021 00:45:49 +0000 Subject: [PATCH] Log door card access time in Calgary timezone --- apiserver/apiserver/api/utils.py | 3 +++ apiserver/apiserver/api/views.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apiserver/apiserver/api/utils.py b/apiserver/apiserver/api/utils.py index d56ece7..01c6bf6 100644 --- a/apiserver/apiserver/api/utils.py +++ b/apiserver/apiserver/api/utils.py @@ -26,6 +26,9 @@ STATIC_FOLDER = 'data/static/' def today_alberta_tz(): return datetime.now(pytz.timezone('America/Edmonton')).date() +def now_alberta_tz(): + return datetime.now(pytz.timezone('America/Edmonton')) + def alert_tanner(message): try: logger.info('Alerting Tanner: ' + message) diff --git a/apiserver/apiserver/api/views.py b/apiserver/apiserver/api/views.py index 76e432d..8ae20b9 100644 --- a/apiserver/apiserver/api/views.py +++ b/apiserver/apiserver/api/views.py @@ -439,7 +439,8 @@ class DoorViewSet(viewsets.ViewSet, List): member = card.user.member else: member = models.Member.objects.get(id=card.member_id) - logger.info('Name: {} {} ({})'.format(member.first_name, member.last_name, member.id)) + t = utils.now_alberta_tz().strftime('%Y-%m-%d %H:%M:%S, %a %I:%M %p') + logger.info('Time: {} - Name: {} {} ({})'.format(t, member.first_name, member.last_name, member.id)) utils_stats.calc_card_scans()