sqm-dashboards/app/helpers/schedules_helper.rb
Nelson Jovel ad03606d66 Add benchmarks to survey and admin data items. Remove them from measures. Modify seeder
Calculate benchmarks for measures based on a weighted average of survey
and admin data items

Added architectural records
2021-12-28 14:10:34 +01:00

33 lines
683 B
Ruby

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