Skip to content

Commit 328e354

Browse files
authored
OTWO-7508 added return statement if code_set_ids is blank (#1848)
1 parent c6c6d8f commit 328e354

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/models/analysis/query_base.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ def with_analysis
8989
activity_facts[:on_trunk].eq(true).and(activity_facts[:analysis_id].eq(@analysis.id))
9090
end
9191

92+
# rubocop:disable Metrics/MethodLength
9293
def contributor_monthly_commits_query(code_set_ids)
94+
return [] if code_set_ids.blank?
95+
9396
commit_name_ids = AnalysisAlias.where(preferred_name_id: @name_id, analysis_id: @analysis.id).pluck(:commit_name_id)
9497
sql = <<-SQL.squish
9598
select to_char(date(C.time),'MON,YYYY') as month, count (*) as count
@@ -101,4 +104,5 @@ def contributor_monthly_commits_query(code_set_ids)
101104
data = commit_name_ids.present? ? ApplicationRecord.connection.execute(sql).try(:to_json) : commit_name_ids.to_s
102105
JSON.parse(data)
103106
end
107+
# rubocop:enable Metrics/MethodLength
104108
end

0 commit comments

Comments
 (0)