Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/overdue allow dooraccess #391

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,23 @@ def phone_list(self, request, format=None):

# collect list of all users that have door access
users_with_door_access = []

# Members with active door access
for ss in (
ServiceSubscription.objects.select_related("user")
.filter(service=drfx_settings.DEFAULT_ACCOUNT_SERVICE)
.filter(state=ServiceSubscription.ACTIVE)
):
users_with_door_access.append(ss.user)

# Members with overdue door access
for ss in (
ServiceSubscription.objects.select_related("user")
.filter(service=drfx_settings.DEFAULT_ACCOUNT_SERVICE)
.filter(state=ServiceSubscription.OVERDUE)
):
users_with_door_access.append(ss.user)

olmari marked this conversation as resolved.
Show resolved Hide resolved
# and output it
outserializer = UserAccessSerializer(users_with_door_access, many=True)
return Response(outserializer.data)
Expand Down
2 changes: 1 addition & 1 deletion users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def has_door_access(self):
subscription = self.servicesubscription_set.get(
service=drfx_settings.DEFAULT_ACCOUNT_SERVICE
)
if subscription.state == ServiceSubscription.ACTIVE:
if subscription.state == ServiceSubscription.ACTIVE or subscription.state == ServiceSubscription.OVERDUE:
return True
except Exception:
pass
Expand Down