diff --git a/TODO.md b/TODO.md index 507760e..62464a5 100644 --- a/TODO.md +++ b/TODO.md @@ -11,8 +11,9 @@ 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? @@ -20,6 +21,8 @@ Things look good so far. Below are the things we talked about and wanted to get * 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 @@ -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. diff --git a/app/javascript/components/SignUp.vue b/app/javascript/components/SignUp.vue index 00e1985..199014c 100644 --- a/app/javascript/components/SignUp.vue +++ b/app/javascript/components/SignUp.vue @@ -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 => { diff --git a/db/migrate/20200419152704_add_geo_to_region.rb b/db/migrate/20200419152704_add_geo_to_region.rb new file mode 100644 index 0000000..3a6e2ba --- /dev/null +++ b/db/migrate/20200419152704_add_geo_to_region.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index b41ebdf..60d48be 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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 @@ -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|