From ee4e1a6a071a25baa021c011b1e8a4fdae49248b Mon Sep 17 00:00:00 2001 From: Rechner Fox <659028+rechner@users.noreply.github.com> Date: Thu, 1 Feb 2024 15:09:04 -0800 Subject: [PATCH 1/2] Update SpaceAPI to return integer version number --- memberportal/api_spacedirectory/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memberportal/api_spacedirectory/views.py b/memberportal/api_spacedirectory/views.py index 3bb15975..71576587 100644 --- a/memberportal/api_spacedirectory/views.py +++ b/memberportal/api_spacedirectory/views.py @@ -103,7 +103,7 @@ def get(self, request): "open": config.SPACE_DIRECTORY_ICON_OPEN, "closed": config.SPACE_DIRECTORY_ICON_CLOSED, } - spaceapi["api_compatibility"] = ["0.14"] + spaceapi["api_compatibility"] = ["14"] ## Add the sensor data to the main body of the schema spaceapi["sensors"] = sensor_data From e194f2720ff8f21cf3088850001dc072103be530 Mon Sep 17 00:00:00 2001 From: Rechner Fox <659028+rechner@users.noreply.github.com> Date: Thu, 1 Feb 2024 15:25:42 -0800 Subject: [PATCH 2/2] Update pre-commit hook and re-format --- .pre-commit-config.yaml | 2 +- memberportal/api_admin_tools/views.py | 8 +++++--- memberportal/api_general/views.py | 16 ++++++++-------- memberportal/membermatters/urls.py | 1 + memberportal/membermatters/wsgi.py | 1 + memberportal/profile/models.py | 26 +++++++++++++++----------- 6 files changed, 31 insertions(+), 23 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 79ed3d1a..12e4e132 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: 21.8b0 + rev: 24.1.1 hooks: - id: black language_version: python3 diff --git a/memberportal/api_admin_tools/views.py b/memberportal/api_admin_tools/views.py index b8547cc0..7cf61c45 100644 --- a/memberportal/api_admin_tools/views.py +++ b/memberportal/api_admin_tools/views.py @@ -726,9 +726,11 @@ def get(self, request, member_id): "totalTime": interlock_log.total_time, "totalCost": (interlock_log.total_cost or 0) / 100, "status": status, - "userEnded": interlock_log.user_ended.get_full_name() - if interlock_log.user_ended - else None, + "userEnded": ( + interlock_log.user_ended.get_full_name() + if interlock_log.user_ended + else None + ), } ) diff --git a/memberportal/api_general/views.py b/memberportal/api_general/views.py index 18525b57..9b0c139a 100644 --- a/memberportal/api_general/views.py +++ b/memberportal/api_general/views.py @@ -394,14 +394,14 @@ def get(self, request): "expiry": p.stripe_card_expiry, }, }, - "membershipPlan": p.membership_plan.get_object() - if p.membership_plan - else None, - "membershipTier": p.membership_plan.member_tier.get_object() - if p.membership_plan - else None - if p.membership_plan - else None, + "membershipPlan": ( + p.membership_plan.get_object() if p.membership_plan else None + ), + "membershipTier": ( + p.membership_plan.member_tier.get_object() + if p.membership_plan + else None if p.membership_plan else None + ), "subscriptionState": p.subscription_status, }, "permissions": {"admin": user.is_admin}, diff --git a/memberportal/membermatters/urls.py b/memberportal/membermatters/urls.py index 2b9e0a20..3d933e30 100644 --- a/memberportal/membermatters/urls.py +++ b/memberportal/membermatters/urls.py @@ -1,5 +1,6 @@ """membermatters URL Configuration """ + import os import django.db.utils from django.contrib import admin diff --git a/memberportal/membermatters/wsgi.py b/memberportal/membermatters/wsgi.py index 603dcc85..bb9ef76f 100644 --- a/memberportal/membermatters/wsgi.py +++ b/memberportal/membermatters/wsgi.py @@ -3,6 +3,7 @@ For more information on this file, see https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/ """ + import os from django.core.wsgi import get_wsgi_application import logging, sys diff --git a/memberportal/profile/models.py b/memberportal/profile/models.py index e41624f1..a02dadfb 100644 --- a/memberportal/profile/models.py +++ b/memberportal/profile/models.py @@ -538,19 +538,23 @@ def get_basic_profile(self): "rfid": self.rfid, "memberBucks": { "balance": self.memberbucks_balance, - "lastPurchase": self.last_memberbucks_purchase.strftime( - "%m/%d/%Y, %H:%M:%S" - ) - if self.last_memberbucks_purchase - else None, + "lastPurchase": ( + self.last_memberbucks_purchase.strftime("%m/%d/%Y, %H:%M:%S") + if self.last_memberbucks_purchase + else None + ), }, "updateProfileRequired": self.must_update_profile, - "lastSeen": self.last_seen.strftime("%m/%d/%Y, %H:%M:%S") - if self.last_seen - else None, - "lastInduction": self.last_induction.strftime("%m/%d/%Y, %H:%M:%S") - if self.last_induction - else None, + "lastSeen": ( + self.last_seen.strftime("%m/%d/%Y, %H:%M:%S") + if self.last_seen + else None + ), + "lastInduction": ( + self.last_induction.strftime("%m/%d/%Y, %H:%M:%S") + if self.last_induction + else None + ), "stripe": { "cardExpiry": self.stripe_card_expiry, "last4": self.stripe_card_last_digits,