Skip to content

Commit

Permalink
Fix Zipcode error
Browse files Browse the repository at this point in the history
  • Loading branch information
BradHN1 committed Aug 1, 2023
1 parent 4c31bdd commit 98c7639
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/api/handlers/community.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ def list(self, request):
args: dict = context.args

# self.validator.expect("zipcode", str, is_required=False)
self.validator.expect("zipcode", str, is_required=False)
self.validator.expect("max_distance", int, is_required=False)

args, err = self.validator.verify(args)
if err:
return err
Expand Down
5 changes: 3 additions & 2 deletions src/api/store/community.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,6 @@ def list_communities(

# check for zipcode:
if zipcode := args.get("zipcode", None):

if zipcodes.is_real(zipcode):
# filter communities by coordinates
filtered_communities = []
Expand All @@ -647,10 +646,12 @@ def list_communities(
max_distance = args.get("max_distance", 25)

added_communities = []

for community in communities:
if community.is_geographically_focused:
for location in community.locations.all():
# skip locations that don't include zipcode (bogus data in dev)
if not location.zipcode:
continue
community_zipcode_info = zipcodes.matching(
location.zipcode
)
Expand Down

0 comments on commit 98c7639

Please sign in to comment.