diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-04 12:12:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-04 12:12:56 +0300 |
commit | 191020103bd4d2aad99c62a35201c05d9df74f8f (patch) | |
tree | 83ef6f71fea1f66842545e9af788fdc33d34d48b /app/models/analytics | |
parent | 5bfd7a344b73d6a9482b420fa7646f7d1760a566 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/analytics')
-rw-r--r-- | app/models/analytics/cycle_analytics/issue_stage_event.rb | 6 | ||||
-rw-r--r-- | app/models/analytics/cycle_analytics/merge_request_stage_event.rb | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/app/models/analytics/cycle_analytics/issue_stage_event.rb b/app/models/analytics/cycle_analytics/issue_stage_event.rb index 333bd20328c..099bb671f10 100644 --- a/app/models/analytics/cycle_analytics/issue_stage_event.rb +++ b/app/models/analytics/cycle_analytics/issue_stage_event.rb @@ -11,6 +11,12 @@ module Analytics alias_attribute :state, :state_id enum state: Issue.available_states, _suffix: true + scope :assigned_to, ->(user) do + assignees_class = IssueAssignee + condition = assignees_class.where(user_id: user).where(arel_table[:issue_id].eq(assignees_class.arel_table[:issue_id])) + where(condition.arel.exists) + end + def self.issuable_id_column :issue_id end diff --git a/app/models/analytics/cycle_analytics/merge_request_stage_event.rb b/app/models/analytics/cycle_analytics/merge_request_stage_event.rb index 537e45058aa..632b7079b2e 100644 --- a/app/models/analytics/cycle_analytics/merge_request_stage_event.rb +++ b/app/models/analytics/cycle_analytics/merge_request_stage_event.rb @@ -11,6 +11,12 @@ module Analytics alias_attribute :state, :state_id enum state: MergeRequest.available_states, _suffix: true + scope :assigned_to, ->(user) do + assignees_class = MergeRequestAssignee + condition = assignees_class.where(user_id: user).where(arel_table[:merge_request_id].eq(assignees_class.arel_table[:merge_request_id])) + where(condition.arel.exists) + end + def self.issuable_id_column :merge_request_id end |