Order by supports in descending order
Just as we do with confidence score, and as admins expect when they order by received supports: the ones with more supports appear first.
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: :asc) }
|
||||
scope :sort_by_supports, -> { reorder(cached_votes_up: :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)}
|
||||
|
||||
@@ -62,15 +62,9 @@ feature 'Admin legislation processes' do
|
||||
select "Supports", from: "order-selector-participation"
|
||||
|
||||
within('#proposals_table') do
|
||||
within(:xpath, "//tbody/tr[1]") do
|
||||
expect(page).to have_content('10')
|
||||
end
|
||||
within(:xpath, "//tbody/tr[2]") do
|
||||
expect(page).to have_content('20')
|
||||
end
|
||||
within(:xpath, "//tbody/tr[3]") do
|
||||
expect(page).to have_content('30')
|
||||
end
|
||||
within(:xpath, "//tbody/tr[1]") { expect(page).to have_content('30') }
|
||||
within(:xpath, "//tbody/tr[2]") { expect(page).to have_content('20') }
|
||||
within(:xpath, "//tbody/tr[3]") { expect(page).to have_content('10') }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user