Skip to content
Extraits de code Groupes Projets
Valider 8da40221 rédigé par echarp's avatar echarp
Parcourir les fichiers

Digest week working even with no week number

parent 30386b5c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -20,6 +20,8 @@ class DigestsController < ApplicationController
private
def set_week
return unless params[:period][:week].present?
@week = Date.commercial params[:period][:year].to_i,
params[:period][:week].to_i
end
......
......@@ -58,7 +58,10 @@ class Event < ApplicationRecord
start_date.to_date.end_of_month.end_of_week.end_of_day
end)
scope :period, (lambda do |year, week|
start_date = Date.commercial(year.to_i, week.to_i)
start_date = Date.commercial(
year.to_i,
(week || (Time.zone.today + 7.days).cweek).to_i
)
where '? <= end_time and start_time <= ?',
start_date, start_date.end_of_week.end_of_day
end)
......
- title = t '.title', week: @week.cweek, year: @week.year
- title = t '.title', week: @week.cweek, year: (@week + 4.days).year
- description = capture_haml do
= t '.week', count: @events.count, count_by_country: count_by_country(@events)
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter