Sha256: 5186d1c5dff49f2878045007cb4ebc449cd58bede4ac26bf7556b87568c3e2c1

Contents?: true

Size: 603 Bytes

Versions: 7

Compression:

Stored size: 603 Bytes

Contents

class Issue < ActiveRecord::Base
  include ReportsKit::Model

  belongs_to :repo
  has_many :issues_labels
  has_many :labels, through: :issues_labels
  has_many :tags

  reports_kit do
    aggregation :average_duration, [:average, REPORTS_KIT_DATABASE_TYPE == :mysql ? 'DATEDIFF(closed_at, opened_at)' : '(closed_at::date - opened_at::date)']
    contextual_filter :for_repo, ->(relation, context_params) { context_params ? relation.where(repo_id: context_params[:repo_id]) : relation }
    dimension :titleized_state, group: 'issues.state', key_to_label: -> (state) { state.try(:titleize) }
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
reports_kits-0.7.8 spec/support/models/issue.rb
reports_kits-0.7.7 spec/support/models/issue.rb
reports_kit-0.7.1 spec/support/models/issue.rb
reports_kit-0.7.0 spec/support/models/issue.rb
reports_kit-0.5.0 spec/support/models/issue.rb
reports_kit-0.4.1 spec/support/models/issue.rb
reports_kit-0.4.0 spec/support/models/issue.rb