예제 #1
0
def get_userZipcode(user, valid_zip):
    location = detect_home_from_db(user)
    current_db = get_profile_db()
    user_pro = current_db.find_one({"$and":[{'source':'Shankari'},{'user_id':user}]})
    if valid_zip and user_pro.get('zip'):
        return user_pro['zip']
    elif location!='N/A':
        # Convert from our internal GeoJSON specific (lng, lat) to the (lat, lng)
        # format required by geocoder
        return _geocodeZipcode(user_pro, location)
    else:
        return 'N/A'
예제 #2
0
def _check_zip_validity(user_home, user):
    if user_home != "N/A" and detect_home_from_db(
            user) != "N/A" and calDistance(
                user_home, detect_home_from_db(user)) < TOLERANCE:
        return True
    return False
예제 #3
0
def _check_zip_validity(user_home, user):
    if user_home != "N/A" and detect_home_from_db(user) != "N/A" and calDistance(user_home, detect_home_from_db(user)) < TOLERANCE:
        return True
    return False