Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/models/analysis/query_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ def with_analysis
activity_facts[:on_trunk].eq(true).and(activity_facts[:analysis_id].eq(@analysis.id))
end

# rubocop:disable Metrics/MethodLength
def contributor_monthly_commits_query(code_set_ids)
return [] if code_set_ids.blank?

commit_name_ids = AnalysisAlias.where(preferred_name_id: @name_id, analysis_id: @analysis.id).pluck(:commit_name_id)
sql = <<-SQL.squish
select to_char(date(C.time),'MON,YYYY') as month, count (*) as count
Expand All @@ -101,4 +104,5 @@ def contributor_monthly_commits_query(code_set_ids)
data = commit_name_ids.present? ? ApplicationRecord.connection.execute(sql).try(:to_json) : commit_name_ids.to_s
JSON.parse(data)
end
# rubocop:enable Metrics/MethodLength
end