Class: DailyFocus::ReviewWorkDayPreloader

Inherits:
Object
  • Object
show all
Defined in:
app/services/daily_focus/review_work_day_preloader.rb

Overview

Seeds +@preloaded_time_off_events+ and +@preloaded_working_hours+ on each employee so
+work_status_on_day+ / +working_on_day?+ stay accurate without per-rep query spam on review.

Class Method Summary collapse

Class Method Details

.call(employees, date) ⇒ Object



7
8
9
10
11
12
13
14
# File 'app/services/daily_focus/review_work_day_preloader.rb', line 7

def self.call(employees, date)
  date = date.to_date
  ids = employees.map(&:id)
  return if ids.empty?

  preload_time_off!(employees, ids, date)
  preload_working_hours!(employees, ids, date)
end