From 352f41fc15e089d6537ba5e328c65c92d2eb3ef5 Mon Sep 17 00:00:00 2001 From: Hyang Im Lyn Lee Date: Thu, 28 Jul 2016 10:14:11 -0700 Subject: [PATCH 1/3] pulling from integration --- app/assets/javascripts/components/organization.jsx | 2 +- app/assets/javascripts/components/organization_display.jsx | 1 + app/controllers/events_controller.rb | 4 ++-- spec/controllers/organizations_controller_spec.rb | 4 +++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/components/organization.jsx b/app/assets/javascripts/components/organization.jsx index d151cbb..08b9e58 100644 --- a/app/assets/javascripts/components/organization.jsx +++ b/app/assets/javascripts/components/organization.jsx @@ -5,7 +5,7 @@ var Organization = React.createClass({ ); }, teamSizeMatched: function() { - var sizeInput = this.props.sizeInput; + var sizeInput = this.props.techSizeSearch; var techTeamSize = this.props.organization.tech_team_size; return ( diff --git a/app/assets/javascripts/components/organization_display.jsx b/app/assets/javascripts/components/organization_display.jsx index 46579d2..acb67cb 100644 --- a/app/assets/javascripts/components/organization_display.jsx +++ b/app/assets/javascripts/components/organization_display.jsx @@ -31,6 +31,7 @@ var OrganizationsDisplay = React.createClass({
{ organizations } + { console.log(organizations) }

diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index 8f16912..fa6c925 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -3,7 +3,7 @@ class EventsController < ApplicationController def create @event = Event.new(event_params) if @event.save - redirect_to admin_events_path, flash: "Event Added" + redirect_to admin_events_path, notice: "Event Added" else redirect_to admin_events_path, alert: "Event Not Added" end @@ -16,7 +16,7 @@ def index def destroy @event = Event.find params[:id] if @event.destroy - redirect_to admin_events_path, flash: "Event Removed" + redirect_to admin_events_path, notice: "Event Removed" else redirect_to admin_events_path, alert: "Event Not Removed" end diff --git a/spec/controllers/organizations_controller_spec.rb b/spec/controllers/organizations_controller_spec.rb index b1339d7..280fd1c 100644 --- a/spec/controllers/organizations_controller_spec.rb +++ b/spec/controllers/organizations_controller_spec.rb @@ -79,6 +79,8 @@ expect(assigns(:organization)).to eq(published_organization) end end + + end describe "#index" do @@ -101,7 +103,7 @@ get :index expect(assigns(:organizations)).to include(unpublished_organization) end - + it "does display published organizations on index" do get :index expect(assigns(:organizations)).to include(published_organization) From 8362caea7b98f87e447c686e6f36190f5b611097 Mon Sep 17 00:00:00 2001 From: Hyang Im Lyn Lee Date: Thu, 28 Jul 2016 11:21:20 -0700 Subject: [PATCH 2/3] test for matching meetup and organization done --- app/controllers/organizations_controller.rb | 7 +++---- app/models/event.rb | 3 +++ app/views/organizations/show.html.erb | 2 +- spec/controllers/organizations_controller_spec.rb | 11 ++++++++++- spec/factories/events.rb | 2 +- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index ea44a18..78ea478 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -14,7 +14,6 @@ def new def show @claimed = @organization.claim_requests.find_by_status(true) @news_articles = @organization.news_articles - hosting_event respond_to do |format| format.html { render } @@ -95,9 +94,9 @@ def authorize_organization redirect_to root_path unless can? :cru, @organization end - def hosting_event - events = Event.all + def hosted_events org_add = @organization.address.split(",")[0] - @find = events.where("location ILIKE ?", "%#{org_add}%") + @hosted_events ||= Event.hosted_at(org_add) end + helper_method :hosted_events end diff --git a/app/models/event.rb b/app/models/event.rb index 3a829fd..573ba16 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -1,2 +1,5 @@ class Event < ActiveRecord::Base + def self.hosted_at(org_add) + where("location ILIKE ?", "%#{org_add}%") + end end diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index df967cb..e231e5e 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -115,7 +115,7 @@