⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Fix: updated map search to account for state#144

Open
NightFury742 wants to merge 1 commit intoBitByte-TPC:masterfrom
NightFury742:mapSearch
Open

Fix: updated map search to account for state#144
NightFury742 wants to merge 1 commit intoBitByte-TPC:masterfrom
NightFury742:mapSearch

Conversation

@NightFury742
Copy link
Collaborator

Fixes issue: #126

Description:

This PR fixes the discrepancies in the profiles shown on the result page due to same city name.

The map search now accounts for state along with city to filter out profiles effectively.

def mapSearch(request):
location = request.GET.get('search', '')
city = location.split(',', 1)[0]
state= location.split(',')[1].strip()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will throw an IndexError if split only generates a list of 1 length. state should be set to '' if no state is passed.

profiles = profiles.order_by('name')
else:
profiles = Profile.objects.filter(city=city)
profiles = Profile.objects.filter(city="")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This returns an empty QuerySet, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants