Show cached_votes_score on admin legislation proposals
This commit is contained in:
@@ -47,7 +47,7 @@ class Legislation::Proposal < ActiveRecord::Base
|
||||
scope :sort_by_most_commented, -> { reorder(comments_count: :desc) }
|
||||
scope :sort_by_title, -> { reorder(title: :asc) }
|
||||
scope :sort_by_id, -> { reorder(id: :asc) }
|
||||
scope :sort_by_supports, -> { reorder(cached_votes_up: :desc) }
|
||||
scope :sort_by_supports, -> { reorder(cached_votes_score: :desc) }
|
||||
scope :sort_by_random, -> { reorder("RANDOM()") }
|
||||
scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) }
|
||||
scope :last_week, -> { where("proposals.created_at >= ?", 7.days.ago)}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<tr id="<%= dom_id(proposal) %>" class="legislation_proposal">
|
||||
<td class="text-center"><%= proposal.id %></td>
|
||||
<td><%= proposal.title %></td>
|
||||
<td class="text-center"><%= proposal.cached_votes_up %></td>
|
||||
<td class="text-center"><%= proposal.votes_score %></td>
|
||||
<td class="select"><%= render "select_proposal", proposal: proposal %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
@@ -456,7 +456,7 @@ en:
|
||||
orders:
|
||||
id: Id
|
||||
title: Title
|
||||
supports: Supports
|
||||
supports: Total supports
|
||||
process:
|
||||
title: Process
|
||||
comments: Comments
|
||||
@@ -481,7 +481,7 @@ en:
|
||||
back: Back
|
||||
id: Id
|
||||
title: Title
|
||||
supports: Supports
|
||||
supports: Total supports
|
||||
select: Select
|
||||
selected: Selected
|
||||
form:
|
||||
|
||||
@@ -457,7 +457,7 @@ es:
|
||||
orders:
|
||||
id: Id
|
||||
title: Título
|
||||
supports: Apoyos
|
||||
supports: Apoyos totales
|
||||
process:
|
||||
title: Proceso
|
||||
comments: Comentarios
|
||||
@@ -481,7 +481,7 @@ es:
|
||||
title: Título
|
||||
back: Volver
|
||||
id: Id
|
||||
supports: Apoyos
|
||||
supports: Apoyos totales
|
||||
select: Seleccionar
|
||||
selected: Seleccionada
|
||||
form:
|
||||
|
||||
@@ -10,20 +10,20 @@ feature 'Admin legislation processes' do
|
||||
context "Index" do
|
||||
|
||||
scenario 'Displaying legislation proposals' do
|
||||
proposal = create(:legislation_proposal, cached_votes_up: 10)
|
||||
proposal = create(:legislation_proposal, cached_votes_score: 10)
|
||||
|
||||
visit admin_legislation_process_proposals_path(proposal.legislation_process_id)
|
||||
|
||||
within "#legislation_proposal_#{proposal.id}" do
|
||||
expect(page).to have_content(proposal.title)
|
||||
expect(page).to have_content(proposal.id)
|
||||
expect(page).to have_content(proposal.cached_votes_up)
|
||||
expect(page).to have_content(proposal.cached_votes_score)
|
||||
expect(page).to have_content('Select')
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'Selecting legislation proposals', :js do
|
||||
proposal = create(:legislation_proposal, cached_votes_up: 10)
|
||||
proposal = create(:legislation_proposal, cached_votes_score: 10)
|
||||
|
||||
visit admin_legislation_process_proposals_path(proposal.legislation_process_id)
|
||||
click_link 'Select'
|
||||
@@ -51,12 +51,12 @@ feature 'Admin legislation processes' do
|
||||
|
||||
scenario 'Sorting legislation proposals by supports', js: true do
|
||||
process = create(:legislation_process)
|
||||
create(:legislation_proposal, cached_votes_up: 10, legislation_process_id: process.id)
|
||||
create(:legislation_proposal, cached_votes_up: 30, legislation_process_id: process.id)
|
||||
create(:legislation_proposal, cached_votes_up: 20, legislation_process_id: process.id)
|
||||
create(:legislation_proposal, cached_votes_score: 10, legislation_process_id: process.id)
|
||||
create(:legislation_proposal, cached_votes_score: 30, legislation_process_id: process.id)
|
||||
create(:legislation_proposal, cached_votes_score: 20, legislation_process_id: process.id)
|
||||
|
||||
visit admin_legislation_process_proposals_path(process.id)
|
||||
select "Supports", from: "order-selector-participation"
|
||||
select "Total supports", from: "order-selector-participation"
|
||||
|
||||
within('#legislation_proposals_list') do
|
||||
within all('.legislation_proposal')[0] { expect(page).to have_content('30') }
|
||||
|
||||
@@ -128,7 +128,7 @@ feature 'Votes' do
|
||||
|
||||
visit debate_path(debate)
|
||||
|
||||
expect(page).to have_content "2 votes"
|
||||
expect(page).to have_content "No votes"
|
||||
|
||||
within('.in-favor') do
|
||||
expect(page).to have_content "50%"
|
||||
|
||||
Reference in New Issue
Block a user