lib/jira-profiler/project.rb
def history
      if @history.nil?
        @history = calendar
        logger.info "Calculating stats for #{issues.count} issues"

        calendar.each_pair do |date_key, date_data|

          # Prepare to calculate the totals for sprints
          unless @sprints.has_key?(date_data[:sprint])
            @sprints[date_data[:sprint]] = {
              :assignees   => {},
              :issue_types => {},
              :calendar    => ActiveSupport::OrderedHash.new()
            }
          end

          # Get type data reference
          sprint_data   = @sprints[date_data[:sprint]]
          assignee_data = date_data[:assignees]
          type_data     = date_data[:issue_types]

          # Loop over each activity for the day and talley up event counts
          activity.fetch(date_key, [])
          activity.each do |change|

            # Prepare to save for assignees
            unless assignee_data.has_key?(change.assignee)
              assignee_data[change.assignee] = {}
              sprint_data[:assignees][change.assignee] = {}
            end

            # Make sure there is hash for this type
            unless type_data.has_key?(change.issue.type)
              type_data[change.issue.type] = {}
              sprint_data[:issue_types][change.issue.type] = {}
              assignee_data[change.assignee][change.issue.type] = {}
              sprint_data[:assignees][change.assignee][change.issue.type] = {}
            end

            # Make sure there is an array for the event type
            unless type_data[change.issue.type].has_key?(change.event)
              type_data[change.issue.type][change.event] = Set.new()
              sprint_data[:issue_types][change.issue.type][change.event] = Set.new()
              assignee_data[change.assignee][change.issue.type][change.event] = Set.new()
              sprint_data[:assignees][change.assignee][change.issue.type][change.event] = Set.new()
            end

            # Add the issue to the sets
            type_data[change.issue.type][change.event] << change.issue
            sprint_data[:issue_types][change.issue.type][change.event] << change.issue
            assignee_data[change.assignee][change.issue.type][change.event] << change.issue
            sprint_data[:assignees][change.assignee][change.issue.type][change.event] << change.issue

          end

        end

      end
      @history
    end
# An Ordered Hash reflecting the day by day project activity, keyed by date in YYY.MM.DD format
An Ordered Hash reflecting the day by day project activity, keyed by date in YYY.MM.DD format
An Ordered Hash reflecting the day by day project activity keyed by date in YYY . MM . DD format
def history
      if @history.nil?
        @history = calendar
        logger.info "Calculating stats for #{issues.count} issues"
        calendar.each_pair do |date_key, date_data|
          unless @sprints.has_key?(date_data[:sprint])
            @sprints[date_data[:sprint]] = {
              :assignees   => {},
              :issue_types => {},
              :calendar    => ActiveSupport::OrderedHash.new()
            }
          end
          sprint_data   = @sprints[date_data[:sprint]]
          assignee_data = date_data[:assignees]
          type_data     = date_data[:issue_types]
          activity.fetch(date_key, [])
          activity.each do |change|
            unless assignee_data.has_key?(change.assignee)
              assignee_data[change.assignee] = {}
              sprint_data[:assignees][change.assignee] = {}
            end
            unless type_data.has_key?(change.issue.type)
              type_data[change.issue.type] = {}
              sprint_data[:issue_types][change.issue.type] = {}
              assignee_data[change.assignee][change.issue.type] = {}
              sprint_data[:assignees][change.assignee][change.issue.type] = {}
            end
            unless type_data[change.issue.type].has_key?(change.event)
              type_data[change.issue.type][change.event] = Set.new()
              sprint_data[:issue_types][change.issue.type][change.event] = Set.new()
              assignee_data[change.assignee][change.issue.type][change.event] = Set.new()
              sprint_data[:assignees][change.assignee][change.issue.type][change.event] = Set.new()
            end
            type_data[change.issue.type][change.event] << change.issue
            sprint_data[:issue_types][change.issue.type][change.event] << change.issue
            assignee_data[change.assignee][change.issue.type][change.event] << change.issue
            sprint_data[:assignees][change.assignee][change.issue.type][change.event] << change.issue
          end
        end
      end
      @history
    end
def history if @history . nil? @history = calendar logger . info "Calculating stats for #{issues.count} issues" calendar . each_pair do | date_key , date_data | unless @sprints . has_key? ( date_data [ :sprint ] ) @sprints [ date_data [ :sprint ] ] = { :assignees => { } , :issue_types => { } , :calendar => ActiveSupport :: OrderedHash . new ( ) } end sprint_data = @sprints [ date_data [ :sprint ] ] assignee_data = date_data [ :assignees ] type_data = date_data [ :issue_types ] activity . fetch ( date_key , [ ] ) activity . each do | change | unless assignee_data . has_key? ( change . assignee ) assignee_data [ change . assignee ] = { } sprint_data [ :assignees ] [ change . assignee ] = { } end unless type_data . has_key? ( change . issue . type ) type_data [ change . issue . type ] = { } sprint_data [ :issue_types ] [ change . issue . type ] = { } assignee_data [ change . assignee ] [ change . issue . type ] = { } sprint_data [ :assignees ] [ change . assignee ] [ change . issue . type ] = { } end unless type_data [ change . issue . type ] . has_key? ( change . event ) type_data [ change . issue . type ] [ change . event ] = Set . new ( ) sprint_data [ :issue_types ] [ change . issue . type ] [ change . event ] = Set . new ( ) assignee_data [ change . assignee ] [ change . issue . type ] [ change . event ] = Set . new ( ) sprint_data [ :assignees ] [ change . assignee ] [ change . issue . type ] [ change . event ] = Set . new ( ) end type_data [ change . issue . type ] [ change . event ] << change . issue sprint_data [ :issue_types ] [ change . issue . type ] [ change . event ] << change . issue assignee_data [ change . assignee ] [ change . issue . type ] [ change . event ] << change . issue sprint_data [ :assignees ] [ change . assignee ] [ change . issue . type ] [ change . event ] << change . issue end end end @history end
An Ordered Hash reflecting the day by day project activity, keyed by date in YYY.MM.DD format
An Ordered Hash reflecting the day by day project activity keyed by date in YYY . MM . DD format
# Prepare to calculate the totals for sprints # Get type data reference # Loop over each activity for the day and talley up event counts # Prepare to save for assignees # Make sure there is hash for this type # Make sure there is an array for the event type # Add the issue to the sets