lib/jira-profiler/project.rb
# An Ordered Hash reflecting the day by day sprint calendar for the project, keyed by date in YYY.MM.DD format
An Ordered Hash reflecting the day by day sprint calendar for the project, keyed by date in YYY.MM.DD format
An Ordered Hash reflecting the day by day sprint calendar for the project keyed by date in YYY . MM . DD format
def calendar(from_date = nil, to_date = nil)
      if @calendar.nil?
        logger.debug "Building project calendar"
        @calendar    = ActiveSupport::OrderedHash.new()
        from_date    = sprints.values.first.start_date if from_date.nil?
        to_date      = Date.today() if to_date.nil?
        sprint_label = nil
        (from_date..to_date).each_with_index do |cur_date, day_index|
          date_key       = cur_date.as_sortable_date
          sprint_label   = sprint_schedule.fetch(date_key, sprint_label)
          day_of_sprint  = cur_date.days_from(sprint.from_date).to_i
          week_of_sprint = day_of_sprint / 7
          week_index     = day_index / 7       
          @calendar[date_key] = {
            :date       => cur_date,
            :uweek      => cur_date.strftime('%U').to_i + 1,
            :day_index  => day_index + 1,
            :week_index => week_index,
            :day_of_sprint => day_of_sprint,
            :week_of_sprint => week_of_sprint,
            :sprint      => sprints[sprint_label],
            :issue_types => {}, 
            :assignees   => {},  
          }
        end
      end
      @calendar
    end
def calendar ( from_date = nil , to_date = nil ) if @calendar . nil? logger . debug "Building project calendar" @calendar = ActiveSupport :: OrderedHash . new ( ) from_date = sprints . values . first . start_date if from_date . nil? to_date = Date . today ( ) if to_date . nil? sprint_label = nil ( from_date .. to_date ) . each_with_index do | cur_date , day_index | date_key = cur_date . as_sortable_date sprint_label = sprint_schedule . fetch ( date_key , sprint_label ) day_of_sprint = cur_date . days_from ( sprint . from_date ) . to_i week_of_sprint = day_of_sprint / 7 week_index = day_index / 7 @calendar [ date_key ] = { :date => cur_date , :uweek => cur_date . strftime ( '%U' ) . to_i + 1 , :day_index => day_index + 1 , :week_index => week_index , :day_of_sprint => day_of_sprint , :week_of_sprint => week_of_sprint , :sprint => sprints [ sprint_label ] , :issue_types => { } , :assignees => { } , } end end @calendar end
An Ordered Hash reflecting the day by day sprint calendar for the project, keyed by date in YYY.MM.DD format
An Ordered Hash reflecting the day by day sprint calendar for the project keyed by date in YYY . MM . DD format
# Establish the bounds of the calendar # Add all days between start date and today # week_index is the number of weeks that have passed since the start of the calendar # weekday_index  = cur_date.wday # weekday        = cur_date.strftime('%A') # Sunday # Build up a reference table with date and sprint data # TODO: Add a key for each type initilized to {:created => 0} # TODO: Add a key for each user initilized to {:created => 0} # puts "#{date_key} : #{week_index} : #{day_index} : Sprint #{sprint.label} (#{days_in_sprint}): #{week_of_sprint} : #{day_of_sprint} : #{cur_date.weekend?} : #{weekday} (#{weekday_index})"
from_date
to_date