From 9a6e3219c904cd04c1bb27807af8ea5a2b9e08c6 Mon Sep 17 00:00:00 2001 From: "depfu[bot]" Date: Thu, 28 Sep 2017 14:14:06 +0000 Subject: [PATCH 1/2] Update nokogiri to version 1.8.1 --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6435af58e..72b60628e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -251,7 +251,7 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) mimemagic (0.3.2) - mini_portile2 (2.2.0) + mini_portile2 (2.3.0) minitest (5.10.3) mixlib-cli (1.7.0) mixlib-config (2.2.4) @@ -262,8 +262,8 @@ GEM net-ssh (>= 2.6.5) net-ssh (4.1.0) newrelic_rpm (4.1.0.333) - nokogiri (1.8.0) - mini_portile2 (~> 2.2.0) + nokogiri (1.8.1) + mini_portile2 (~> 2.3.0) nori (2.6.0) oauth (0.5.3) oauth2 (1.4.0) From 07592f6b0d8112dbf7ae3cb58919d0d32813a065 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Fri, 29 Sep 2017 11:50:19 +0200 Subject: [PATCH 2/2] Correct Poll current/expired/incoming scopes and helper functions --- app/models/poll.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/poll.rb b/app/models/poll.rb index 3873ac5e0..24ffa3a06 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -16,23 +16,23 @@ class Poll < ActiveRecord::Base validate :date_range - scope :current, -> { where('starts_at <= ? and ? <= ends_at', Time.current, Time.current) } - scope :incoming, -> { where('? < starts_at', Time.current) } - scope :expired, -> { where('ends_at < ?', Time.current) } + scope :current, -> { where('starts_at <= ? and ? <= ends_at', Date.current.beginning_of_day, Date.current.beginning_of_day) } + scope :incoming, -> { where('? < starts_at', Date.current.beginning_of_day) } + scope :expired, -> { where('ends_at < ?', Date.current.beginning_of_day) } scope :published, -> { where('published = ?', true) } scope :by_geozone_id, ->(geozone_id) { where(geozones: {id: geozone_id}.joins(:geozones)) } scope :sort_for_list, -> { order(:geozone_restricted, :starts_at, :name) } - def current?(timestamp = DateTime.current) + def current?(timestamp = Date.current.beginning_of_day) starts_at <= timestamp && timestamp <= ends_at end - def incoming?(timestamp = DateTime.current) + def incoming?(timestamp = Date.current.beginning_of_day) timestamp < starts_at end - def expired?(timestamp = DateTime.current) + def expired?(timestamp = Date.current.beginning_of_day) ends_at < timestamp end