spec/support/models/issue.rb in reports_kit-0.3.3 vs spec/support/models/issue.rb in reports_kit-0.4.0
- old
+ new
@@ -6,8 +6,9 @@
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