Skip to content

Instantly share code, notes, and snippets.

@austindoeswork
Created September 20, 2018 17:03
Show Gist options
  • Save austindoeswork/6c9d715f84aada21fdfef49e8a6fab4a to your computer and use it in GitHub Desktop.
Save austindoeswork/6c9d715f84aada21fdfef49e8a6fab4a to your computer and use it in GitHub Desktop.
now = Time.zone.now.in_time_zone("US/Pacific")
today = now.to_date
month_start = today.beginning_of_month
week_start = today.beginning_of_week
date_contexts = []
(1..4).each do |i|
d = month_start - i.month
date_contexts << {
s_date: d,
e_date: d + 1.month,
time_range: "month",
}
d = week_start - i.week
date_contexts << {
s_date: d,
e_date: d + 1.week,
time_range: "week",
}
end
call_type_ids = CallType
.where(disabled_at: nil)
.pluck(:id)
BehaviorHistoryWorker.new.rollup(date_contexts, call_type_ids)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment