def map_breweries(): checkins = filter( lambda c: c["brewery"] and c["brewery"]["location"]["lat"] and c["brewery"]["location"]["lng"], checkins_service.all(), ) breweries = dict( ( c["brewery"]["brewery_id"], { "name": c["brewery"]["brewery_name"], "lat": c["brewery"]["location"]["lat"], "lng": c["brewery"]["location"]["lng"], "url": ensure_http_prefix(c["brewery"]["contact"]["url"]), "label": c["brewery"]["brewery_label"], "beers_desc": "You've tasted:", "beers": [], }, ) for c in checkins ) for c in checkins: breweries[c["brewery"]["brewery_id"]]["beers"].append(c["beer"]["beer_name"]) for bid in breweries: breweries[bid]["beers"] = list(set(breweries[bid]["beers"])) return breweries.values()
def map_checkins(): checkins = filter(lambda c: c["venue"], checkins_service.all()) venues = dict((c["venue"]["venue_id"], { "name": c["venue"]["venue_name"], "lat": c["venue"]["location"]["lat"], "lng": c["venue"]["location"]["lng"], "url": ensure_http_prefix(c["venue"]["contact"]["venue_url"]), "label": c["venue"]["venue_icon"]["sm"], "beers_desc": "Beers drunk here:", "beers": [] }) for c in checkins) for c in checkins: beer = "%s by %s" % (c["beer"]["beer_name"], c["brewery"]["brewery_name"]) venues[c["venue"]["venue_id"]]["beers"].append(beer) for bid in venues: venues[bid]["beers"] = list(set(venues[bid]["beers"])) return venues.values()
def map_breweries(): checkins = filter(lambda c: c["brewery"] and c["brewery"]["location"]["lat"] and c["brewery"]["location"]["lng"], checkins_service.all()) breweries = dict((c["brewery"]["brewery_id"], { "name": c["brewery"]["brewery_name"], "lat": c["brewery"]["location"]["lat"], "lng": c["brewery"]["location"]["lng"], "url": ensure_http_prefix(c["brewery"]["contact"]["url"]), "label": c["brewery"]["brewery_label"], "beers_desc": "You\'ve tasted:", "beers": [] }) for c in checkins) for c in checkins: breweries[c["brewery"]["brewery_id"]]["beers"].append(c["beer"]["beer_name"]) for bid in breweries: breweries[bid]["beers"] = list(set(breweries[bid]["beers"])) return breweries.values()
def map_checkins(): checkins = filter(lambda c: c["venue"], checkins_service.all()) venues = dict( ( c["venue"]["venue_id"], { "name": c["venue"]["venue_name"], "lat": c["venue"]["location"]["lat"], "lng": c["venue"]["location"]["lng"], "url": ensure_http_prefix(c["venue"]["contact"]["venue_url"]), "label": c["venue"]["venue_icon"]["sm"], "beers_desc": "Beers drunk here:", "beers": [], }, ) for c in checkins ) for c in checkins: beer = "%s by %s" % (c["beer"]["beer_name"], c["brewery"]["brewery_name"]) venues[c["venue"]["venue_id"]]["beers"].append(beer) for bid in venues: venues[bid]["beers"] = list(set(venues[bid]["beers"])) return venues.values()