From e39447063495a824dd173638e89acae1a23e19aa Mon Sep 17 00:00:00 2001 From: kikito Date: Sun, 29 Jan 2017 22:52:13 +0100 Subject: [PATCH] Improves order of polls when listing them in index --- app/models/poll.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/poll.rb b/app/models/poll.rb index c5da9dcd0..1ac73e837 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -18,7 +18,7 @@ class Poll < ActiveRecord::Base scope :published, -> { where('published = ?', true) } scope :by_geozone_id, ->(geozone_id) { where(geozones: {id: geozone_id}.joins(:geozones)) } - scope :sort_for_list, -> { order(:starts_at) } + scope :sort_for_list, -> { order(:geozone_restricted, :starts_at, :name) } def current?(timestamp = DateTime.current) starts_at <= timestamp && timestamp <= ends_at