Module: ForemanPatch::CyclesHelper

Defined in:
app/helpers/foreman_patch/cycles_helper.rb

Instance Method Summary collapse

Instance Method Details

#cycle_length(cycle) ⇒ Object



4
5
6
7
8
9
10
# File 'app/helpers/foreman_patch/cycles_helper.rb', line 4

def cycle_length(cycle)
  if ForemanPatch::Cycle === cycle
    cycle = cycle.plan
  end

  cycle.interval.send(cycle.units).value / ActiveSupport::Duration::SECONDS_PER_DAY
end

#cycle_windows(cycle, date) ⇒ Object



12
13
14
15
16
# File 'app/helpers/foreman_patch/cycles_helper.rb', line 12

def cycle_windows(cycle, date)
  cycle.windows.select do |window|
    window.start_at.to_date === date
  end
end