Correction rapide sur un soucis d'accès aux evt futurs

recurrent
echarp 8 years ago
parent 2b42a84e27
commit 9911dc0658
  1. 2
      app/controllers/events_controller.rb
  2. 4
      app/models/event.rb

@ -12,7 +12,7 @@ class EventsController < ApplicationController
respond_to do |format|
format.html
format.rss do
@events = @events.includes(:related_city).future params[:daylimit]
@events = @events.includes(:related_city).future_in params[:daylimit]
end
format.ics { @events = @events.last_year.order :id }
format.xml { @events = @events.includes(:related_region).order :id }

@ -23,9 +23,9 @@ class Event < ActiveRecord::Base
where('end_time < ?', DateTime.now).order start_time: :desc
end)
scope :future, (lambda do
where('end_time >= ?', DateTime.now).order start_time: :asc
where('? <= end_time', DateTime.now).order start_time: :asc
end)
scope :future, (lambda do |days|
scope :future_in, (lambda do |days|
days ||= '30'
where('? <= start_time and end_time <= ?',
DateTime.now, days.to_i.days.from_now)

Loading…
Cancel
Save