Skip to content

Commit

Permalink
nit: change logic ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-Jess committed Mar 24, 2024
1 parent b6f777e commit 0c88556
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions backend/sublet/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,18 @@ def list(self, request, *args, **kwargs):
queryset = self.get_queryset()

# Apply filters based on query parameters

if subletter.lower() == "true":
queryset = queryset.filter(subletter=request.user)

Check warning on line 148 in backend/sublet/views.py

View check run for this annotation

Codecov / codecov/patch

backend/sublet/views.py#L148

Added line #L148 was not covered by tests
else:
queryset = queryset.filter(expires_at__gte=timezone.now())
if title:
queryset = queryset.filter(title__icontains=title)
if address:
queryset = queryset.filter(address__icontains=address)
if amenities:
for amenity in amenities:
queryset = queryset.filter(amenities__name=amenity)
if subletter.lower() == "true":
queryset = queryset.filter(subletter=request.user)
else:
queryset = queryset.filter(expires_at__gte=timezone.now())
if starts_before:
queryset = queryset.filter(start_date__lt=starts_before)
if starts_after:
Expand Down

0 comments on commit 0c88556

Please sign in to comment.