From 43a957e2b75c838b5ed946ad952411dda5e5aa1c Mon Sep 17 00:00:00 2001 From: echarp Date: Sat, 27 Jan 2018 18:09:58 +0100 Subject: [PATCH] Quick correction, commercial week is a Date method... --- app/controllers/digests_controller.rb | 2 +- app/models/event.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/digests_controller.rb b/app/controllers/digests_controller.rb index 2b11dc00..ec27726c 100644 --- a/app/controllers/digests_controller.rb +++ b/app/controllers/digests_controller.rb @@ -20,7 +20,7 @@ class DigestsController < ApplicationController private def set_week - @week = Time.commercial params[:period][:year].to_i, + @week = Date.commercial params[:period][:year].to_i, params[:period][:week].to_i end diff --git a/app/models/event.rb b/app/models/event.rb index 041dfc98..8be76df4 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -59,7 +59,7 @@ 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 = Time.commercial(year.to_i, week.to_i) + start_date = Date.commercial(year.to_i, week.to_i) where '? <= end_time and start_time <= ?', start_date, start_date.end_of_week.end_of_day end)