You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sqm-dashboards/app/helpers/schedules_helper.rb

34 lines
683 B

module SchedulesHelper
def options_for_frequency_hours
[
['Once A Day', 24],
['Once A Week', 24 * 7],
['Every Other Week', 2 * 24 * 7],
['Once A Month', 4 * 24 * 7]
]
end
def options_for_time
words = %w[AM PM].map do |time|
[12, *(1..11)].map do |hour|
%w[00 30].map do |minute|
"#{hour}:#{minute} #{time}"
end
end
end.flatten
words.each_with_index.map { |word, index| [word, index * 30] }
end
def frequency_description(hours)
case hours
when (24 * 7)
'Once A Week'
when (2 * 24 * 7)
'Every Other Week'
when (4 * 24 * 7)
'Once A Month'
end
end
end