From 23f3843400b75b6a6e0dc363bfe4f4d6bfee29bc Mon Sep 17 00:00:00 2001 From: Bruce McMoran Date: Sun, 12 Apr 2020 08:13:30 -0700 Subject: [PATCH] fix(bugs): Minor bug fixes * Fixes a bug where things are editable because the var was statically `true` * Fixes a bug in seeds where no comments would be created * Fixes a seeds bug which used random numbers instead of sampling from `Business.all` --- TODO.md | 13 ++++++++++--- app/javascript/components/Comment.vue | 2 +- app/javascript/components/ViewRegion.vue | 2 +- db/seeds.rb | 4 ++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/TODO.md b/TODO.md index 48dcd9d..098c2fa 100644 --- a/TODO.md +++ b/TODO.md @@ -6,6 +6,7 @@ Things look good so far. Below are the things we talked about and wanted to get * Adding an image to an Event fails to reload the comment data * Private posts feature ; tagging in people * Refresh of resourceful pages loses the store data since there's no resource information in the route +* Editability of Events, Posts, and Comments isn't checking permissions properly # Things @@ -15,9 +16,9 @@ Things look good so far. Below are the things we talked about and wanted to get # Features -* A side bar of post topics on the left for Posts section (crime & safety, marketplace, civic information, etc) +* A side bar of post topics on the left for Posts section (crime & safety, marketplace, civic information, etc) [Done] * Events calendar -* Neighborhood creation +* Neighborhood creation [Done] * Posts should show up for the Neighboorhoods selected * A side bar allowing the Neighborhood selection in Posts and Events @@ -34,13 +35,19 @@ rails g migration AddLatLongToLocation lat:decimal long:decimal rails g migration AddPrimaryToLocation primary:boolean sed -i -e 's/null: false/null: true/' db/migration/*add_region_to_location.rb ``` - +s ### Dev Api Key `GOOGLE_API_CREDENTIALS` Restricted to Maps Javascript API from localhost or localhost/* +### Goals + +* Ability to create regions [Done] +* Ability to see regions for business locations [Done] +* Ability to create locations for a business + # Locality * Select Event radius to display Events from diff --git a/app/javascript/components/Comment.vue b/app/javascript/components/Comment.vue index f53e189..6645860 100644 --- a/app/javascript/components/Comment.vue +++ b/app/javascript/components/Comment.vue @@ -42,7 +42,7 @@ export default { }, computed: { isEditor: function() { - return true // if the current user is the same as the comment employee_id + return this.$currentUser.employee_id === this.comment.employee_id } }, created: function() { diff --git a/app/javascript/components/ViewRegion.vue b/app/javascript/components/ViewRegion.vue index c29a8dd..2f0b0aa 100644 --- a/app/javascript/components/ViewRegion.vue +++ b/app/javascript/components/ViewRegion.vue @@ -11,7 +11,7 @@ export default { return { map: null, drawingManager: null, - zoom: 6, + zoom: 10, } }, props: { diff --git a/db/seeds.rb b/db/seeds.rb index 89f07c2..33a5cb2 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -72,9 +72,9 @@ description: Faker::Lorem.paragraph, start_time: Faker::Time.forward(days: (rand * 3).to_i), end_time: Faker::Time.forward(days: (rand * 20).to_i + 4), - business: Business.find((rand * Business.count).to_i + 1), + business: Business.all.sample, ) - (rand * 5).to_i.times do |n| + ((rand * 5)+1).to_i.times do |n| employee = e.business.employees.sample if n % 2 == 0 e.comments.create!(text: Faker::Lorem.paragraph, employee: employee)