<% block_count = 60 / AVAILABILITY_CALENDAR_BLOCK_LENGTH hours_to_show = (AVAILABILITY_CALENDAR_END_TIME - AVAILABILITY_CALENDAR_START_TIME) period_blocks = [{start: AVAILABILITY_CALENDAR_START_TIME, end: 5, label: 'Early Morning'}, {start: 6, end: 11, label: 'Morning'}, {start: 12, end: 17, label: 'Afternoon'}, {start: 18, end: AVAILABILITY_CALENDAR_END_TIME, label: 'Evening'}] %>


<% period_blocks.each do |p| %>
<%= p[:label] %>
<% (p[:start]..p[:end]).each do |hour_index|%>
<% block_count.times do |block_index| %> <% offset = block_offset (hour_index - AVAILABILITY_CALENDAR_START_TIME), block_index %>
<%= time_for_offset offset %>
<% end %>
<% end %>
<% end %>