Le filtrage par région n'inclue plus du tout les evts nationaux

This commit is contained in:
echarp 2014-10-13 23:55:18 +02:00
parent 0d06f2ee69
commit f2f6bcf0cc
5 changed files with 26 additions and 29 deletions

View File

@ -89,10 +89,10 @@ class EventsController < ApplicationController
@events = Event.moderated
@events = @events.region params[:region] \
if params[:region] && params[:region] != 'all'
@events = @events.tag(params[:tag]) if params[:tag]
@events = @events.tag params[:tag] if params[:tag]
end
# Use callbacks to share common setup or constraints between actions.
# Use callbacks to share common setup or constraints between actions
def set_event
if params[:secret].present?
@event = Event.where secret: params[:secret]
@ -103,7 +103,7 @@ class EventsController < ApplicationController
end
# Never trust parameters from the scary internet, only allow the white list
# through.
# through
def event_params
params.require(:event)
.permit :lock_version, :title, :start_time, :end_time, :description,

View File

@ -33,15 +33,15 @@ class Event < ActiveRecord::Base
scope :year, (lambda do |year|
where '? <= end_time and start_time <= ?',
Date.new(year, 1, 1).beginning_of_week,
Date.new(year, 12, 31).end_of_week
Date.new(year, 12, 31).end_of_week.end_of_day
end)
scope :month, (lambda do |start_date|
start_date ||= Date.today
where '? <= end_time and start_time <= ?',
start_date.beginning_of_month.beginning_of_week,
start_date.end_of_month.end_of_week
start_date.end_of_month.end_of_week.end_of_day
end)
scope :region, -> region { where 'region = ? or locality', region }
scope :region, -> region { where region: region }
scope :tag, -> tag { where 'tags like ?', "%#{tag}%" }
scope :geo, -> { where 'latitude is not null and longitude is not null' }

View File

@ -2,4 +2,3 @@ json.extract! @event, :id, :title, :description, :start_time, :end_time,
:address, :city, :region, :locality, :url, :contact, :contact,
:submitter, :moderated, :tags, :secret, :decision_time,
:submission_time, :moderator_mail_id, :submitter_mail_id

View File

@ -119,17 +119,16 @@ it more readable or agreable.
all_regions: All regions
index:
title: Feeds
quick: Each feed lists events for the coming 30 days in a given region.
If you subscribe to a regional feed, you will receive data on this
region's events, but also for all national events, like RMLL.
quick: Each feed lists events for the coming 30 days in a given region
help: "Some interesting features:
\n
\n* You can limit events to a specific tag, through the `tag` parameter. This
will for example let you get a feed of all events organised by you association,
if you do remember to tag all your events with a specific tag. \n
Example: `%{tag}`
\n* You can modify the 30 days limit with the parameter `daylimit`. \n
Example: `%{daylimit}`"
\n
\n* You can limit events to a specific tag, through the `tag`
parameter. This will for example let you get a feed of all events
organised by you association, if you do remember to tag all your events
with a specific tag. \n
Example: `%{tag}`
\n* You can modify the 30 days limit with the parameter `daylimit`. \n
Example: `%{daylimit}`"
stats:
title: Statistics
all: Validated events

View File

@ -115,19 +115,18 @@ fr:
index:
title: Liste des flux
quick: Chaque flux liste les évènements pour les 30 prochains jours en
cours dans une région donnée. En vous abonnant à un flux régional, vous
recevrez des informations sur les évènements de votre région, mais
également les évènements à portée nationale comme les RMLL.
cours dans une région donnée
help: "Quelques fonctionnalités intéressantes:\n
\n
* Vous pouvez limiter les évènements à un certain tag, en passant le paramètre
`tag`. Cela permet par exemple de récupérer un flux des évènements organisés
uniquement par votre association, à partir du moment où vous pensez à marquer
tous vos évènements avec un tag précis. \n
Exemple: `%{tag}`\n
* Vous pouvez modifier la limite des 30 prochains jours des flux en utilisant
le paramètre `daylimit`. \n
Exemple: `%{daylimit}`"
\n
* Vous pouvez limiter les évènements à un certain tag, en passant le
paramètre `tag`. Cela permet par exemple de récupérer un flux des
évènements organisés uniquement par votre association, à partir du
moment où vous pensez à marquer tous vos évènements avec un tag
précis. \n
Exemple: `%{tag}`\n
* Vous pouvez modifier la limite des 30 prochains jours des flux en
utilisant le paramètre `daylimit`. \n
Exemple: `%{daylimit}`"
stats:
title: Statistiques
all: Événements validés