Quick correction, commercial week is a Date method...
This commit is contained in:
parent
b2fc347303
commit
43a957e2b7
@ -20,7 +20,7 @@ class DigestsController < ApplicationController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def set_week
|
def set_week
|
||||||
@week = Time.commercial params[:period][:year].to_i,
|
@week = Date.commercial params[:period][:year].to_i,
|
||||||
params[:period][:week].to_i
|
params[:period][:week].to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class Event < ApplicationRecord
|
|||||||
start_date.to_date.end_of_month.end_of_week.end_of_day
|
start_date.to_date.end_of_month.end_of_week.end_of_day
|
||||||
end)
|
end)
|
||||||
scope :period, (lambda do |year, week|
|
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 <= ?',
|
where '? <= end_time and start_time <= ?',
|
||||||
start_date, start_date.end_of_week.end_of_day
|
start_date, start_date.end_of_week.end_of_day
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user