Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions POI/categories.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ const (
LocationTypeAny = LocationType("")
LocationTypeCafe = LocationType("cafe")
LocationTypeRestaurant = LocationType("restaurant")
LocationTypeBar = LocationType("bar")
LocationTypeBakery = LocationType("bakery")
LocationTypeMealTakeaway = LocationType("meal_takeaway")
LocationTypeMuseum = LocationType("museum")
LocationTypeGallery = LocationType("art_gallery")
LocationTypeAmusementPark = LocationType("amusement_park")
Expand All @@ -61,7 +64,7 @@ func GetPlaceCategory(placeType LocationType) (placeCategory PlaceCategory) {
switch placeType {
case LocationTypePark, LocationTypeAmusementPark, LocationTypeGallery, LocationTypeMuseum:
placeCategory = PlaceCategoryVisit
case LocationTypeCafe, LocationTypeRestaurant:
case LocationTypeCafe, LocationTypeRestaurant, LocationTypeBar, LocationTypeBakery, LocationTypeMealTakeaway:
placeCategory = PlaceCategoryEatery
case LocationTypeShoppingMall, LocationTypeDepartmentStore, LocationTypeSupermarket, LocationTypeClothingStore, LocationTypeStore:
placeCategory = PlaceCategoryShopping
Expand All @@ -83,7 +86,7 @@ func GetPlaceTypes(placeCat PlaceCategory) (placeTypes []LocationType) {
[]LocationType{LocationTypePark, LocationTypeAmusementPark, LocationTypeGallery, LocationTypeMuseum}...)
case PlaceCategoryEatery:
placeTypes = append(placeTypes,
[]LocationType{LocationTypeCafe, LocationTypeRestaurant}...)
[]LocationType{LocationTypeCafe, LocationTypeRestaurant, LocationTypeBar, LocationTypeBakery, LocationTypeMealTakeaway}...)
case PlaceCategoryShopping:
placeTypes = append(placeTypes,
[]LocationType{LocationTypeShoppingMall, LocationTypeDepartmentStore, LocationTypeSupermarket, LocationTypeClothingStore, LocationTypeStore}...)
Expand Down
5 changes: 4 additions & 1 deletion test/place_category_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import (
// TestGetPlaceTypesByCategory pins the Google Maps place types each category expands to.
func TestGetPlaceTypesByCategory(t *testing.T) {
cases := map[POI.PlaceCategory][]POI.LocationType{
POI.PlaceCategoryEatery: {POI.LocationTypeCafe, POI.LocationTypeRestaurant},
POI.PlaceCategoryEatery: {
POI.LocationTypeCafe, POI.LocationTypeRestaurant,
POI.LocationTypeBar, POI.LocationTypeBakery, POI.LocationTypeMealTakeaway,
},
POI.PlaceCategoryShopping: {
POI.LocationTypeShoppingMall, POI.LocationTypeDepartmentStore,
POI.LocationTypeSupermarket, POI.LocationTypeClothingStore, POI.LocationTypeStore,
Expand Down
Loading