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