From 365faeff315b56c215eb1b0c1cf9ff77e38b7e52 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Thu, 29 Dec 2016 12:05:29 +0100 Subject: [PATCH 1/6] removes physical votes from proposals --- app/models/proposal.rb | 2 +- .../20161229110336_remove_physical_votes_from_proposals.rb | 5 +++++ spec/helpers/proposals_helper_spec.rb | 5 ----- 3 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 db/migrate/20161229110336_remove_physical_votes_from_proposals.rb diff --git a/app/models/proposal.rb b/app/models/proposal.rb index 7bd4b7a92..cba6d04ba 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -99,7 +99,7 @@ class Proposal < ActiveRecord::Base end def total_votes - cached_votes_up + physical_votes + cached_votes_up end def voters diff --git a/db/migrate/20161229110336_remove_physical_votes_from_proposals.rb b/db/migrate/20161229110336_remove_physical_votes_from_proposals.rb new file mode 100644 index 000000000..34e0e5e44 --- /dev/null +++ b/db/migrate/20161229110336_remove_physical_votes_from_proposals.rb @@ -0,0 +1,5 @@ +class RemovePhysicalVotesFromProposals < ActiveRecord::Migration + def change + remove_column :proposals, :physical_votes + end +end diff --git a/spec/helpers/proposals_helper_spec.rb b/spec/helpers/proposals_helper_spec.rb index 82206afb5..0f7c70b39 100644 --- a/spec/helpers/proposals_helper_spec.rb +++ b/spec/helpers/proposals_helper_spec.rb @@ -13,11 +13,6 @@ describe ProposalsHelper do expect(progress_bar_percentage(proposal)).to eq 50 end - it "should take into account the physical votes" do - proposal = create(:proposal, cached_votes_up: ((Proposal.votes_needed_for_success/2)-100), physical_votes: 100) - expect(progress_bar_percentage(proposal)).to eq 50 - end - it "should be 100 if there are more votes than needed" do proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success*2) expect(progress_bar_percentage(proposal)).to eq 100 From 2a0267a1af937f7adae64c90aa2ac1abd257ca51 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Thu, 29 Dec 2016 12:34:50 +0100 Subject: [PATCH 2/6] updates db schema --- db/schema.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index acfc87dbb..0c3cfd3cf 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20161221151239) do +ActiveRecord::Schema.define(version: 20161229110336) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -297,7 +297,6 @@ ActiveRecord::Schema.define(version: 20161221151239) do t.string "responsible_name", limit: 60 t.text "summary" t.string "video_url" - t.integer "physical_votes", default: 0 t.tsvector "tsv" t.integer "geozone_id" t.datetime "retired_at" From 43c18d58ac33e01e0e190d69b0cc57cd15a32cba Mon Sep 17 00:00:00 2001 From: rgarcia Date: Thu, 29 Dec 2016 12:47:57 +0100 Subject: [PATCH 3/6] fixes specs --- app/models/proposal.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/proposal.rb b/app/models/proposal.rb index cba6d04ba..2f0c76094 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -50,7 +50,7 @@ class Proposal < ActiveRecord::Base scope :last_week, -> { where("proposals.created_at >= ?", 7.days.ago)} scope :retired, -> { where.not(retired_at: nil) } scope :not_retired, -> { where(retired_at: nil) } - scope :successfull, -> { where("cached_votes_up + physical_votes >= ?", Proposal.votes_needed_for_success)} + scope :successfull, -> { where("cached_votes_up >= ?", Proposal.votes_needed_for_success)} def to_param "#{id}-#{title}".parameterize From 13d9f6c2944a680a242bf6a65710b78d8a264f90 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Fri, 30 Dec 2016 11:55:44 +0100 Subject: [PATCH 4/6] removes obsolete spec --- spec/helpers/proposals_helper_spec.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/spec/helpers/proposals_helper_spec.rb b/spec/helpers/proposals_helper_spec.rb index 0f7c70b39..cee1ec648 100644 --- a/spec/helpers/proposals_helper_spec.rb +++ b/spec/helpers/proposals_helper_spec.rb @@ -40,10 +40,6 @@ describe ProposalsHelper do expect(supports_percentage(proposal)).to eq "100%" end - it "should take into account the physical votes" do - proposal = create(:proposal, physical_votes: Proposal.votes_needed_for_success/2) - expect(supports_percentage(proposal)).to eq "50%" - end end end \ No newline at end of file From d8b4af5add9af8046e8180ef478aa7b2a6134578 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Fri, 30 Dec 2016 17:17:46 +0100 Subject: [PATCH 5/6] adds meta description and keywords --- app/views/layouts/_meta_tags.html.erb | 5 +++++ app/views/layouts/application.html.erb | 3 ++- app/views/layouts/devise.html.erb | 1 + config/locales/settings.en.yml | 2 ++ config/locales/settings.es.yml | 2 ++ db/dev_seeds.rb | 4 ++-- db/seeds.rb | 4 ++++ 7 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 app/views/layouts/_meta_tags.html.erb diff --git a/app/views/layouts/_meta_tags.html.erb b/app/views/layouts/_meta_tags.html.erb new file mode 100644 index 000000000..443f7352f --- /dev/null +++ b/app/views/layouts/_meta_tags.html.erb @@ -0,0 +1,5 @@ +" /> + +" /> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 34e7776fb..7a1dae4d9 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -4,7 +4,8 @@ - <%=render "layouts/tracking_data"%> + <%= render "layouts/tracking_data" %> + <%= render "layouts/meta_tags" %> <%= content_for?(:title) ? yield(:title) : setting['org_name'] %> <%= stylesheet_link_tag "application" %>