Skip to content

Commit

Permalink
feature(region): Capture center for places-derived regions
Browse files Browse the repository at this point in the history
When a region is created from Google Places data, capture the center lat and lng, storing it with the Region data as `center_lat` and `center_lng`
  • Loading branch information
mrmod committed Apr 19, 2020
1 parent 557e347 commit 85a17a7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
11 changes: 9 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ Things look good so far. Below are the things we talked about and wanted to get
# Things

* Posts don't need tags right now [Done]
* Ability to create locations for a business
* Posts should be sortable by post.created_at and latest commented
* Ability to create locations for a business [Done]
* Ability to add new locations to an existing business
* Posts should be sortable by `post.created_at` and latest commented
* Posts should be the default view
* Who commented and when they commented
* Maybe make comments more distinct from the rest of the page?
* Keep the business category information and founding information with the My Business page
* Neighbors should show the other businesses in the same region
** Triggered from a click on MyBusiness.Location showing a list of them broken down by category
* When a region is created, a GoogleBusiness search will find businesses in the region and email them
* Capture the center for a Places-derived region [Done]
* Estimate the center for a Business-derived region polygon

# Features

Expand All @@ -40,6 +43,10 @@ rails g migration AddGooglePlacesToLocation places_id:string places_neighborhood
rails g migration AddEmailToEmployee email:string
```

```
rails g migration AddGeoToRegion center_lat:decimal center_lng:decimal
```

## Feature: Neighborhood creation [Done]

When a business creates a location for itself and it isn't inside of any Region then the business should be allowed to draw a new region and be set as the leader of that region.
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/components/SignUp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ export default {
let region = {
name: location.places_neighborhood,
points: JSON.stringify(regionBounds),
center_lat: vp.getCenter().lat(),
center_lng: vp.getCenter().lng(),
}
return this.$store.dispatch('createRegion', region)
.then(r => {
Expand Down
6 changes: 6 additions & 0 deletions db/migrate/20200419152704_add_geo_to_region.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddGeoToRegion < ActiveRecord::Migration[6.0]
def change
add_column :regions, :center_lat, :decimal
add_column :regions, :center_lng, :decimal
end
end
7 changes: 6 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2020_04_17_141503) do
ActiveRecord::Schema.define(version: 2020_04_19_152704) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

create_table "business_group_members", force: :cascade do |t|
t.integer "business_group_id", null: false
Expand Down Expand Up @@ -136,6 +139,8 @@
t.text "points"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
t.decimal "center_lat"
t.decimal "center_lng"
end

create_table "socials", force: :cascade do |t|
Expand Down

0 comments on commit 85a17a7

Please sign in to comment.