Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
92de19ba
Commit
92de19ba
authored
Nov 27, 2019
by
allison.browne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove join through projects
parent
0be78245
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
3 deletions
+2
-3
app/models/project.rb
app/models/project.rb
+0
-1
lib/gitlab/grafana_embed_usage_data.rb
lib/gitlab/grafana_embed_usage_data.rb
+2
-2
No files found.
app/models/project.rb
View file @
92de19ba
...
@@ -435,7 +435,6 @@ class Project < ApplicationRecord
...
@@ -435,7 +435,6 @@ class Project < ApplicationRecord
scope
:with_merge_requests_available_for_user
,
->
(
current_user
)
{
with_feature_available_for_user
(
:merge_requests
,
current_user
)
}
scope
:with_merge_requests_available_for_user
,
->
(
current_user
)
{
with_feature_available_for_user
(
:merge_requests
,
current_user
)
}
scope
:with_merge_requests_enabled
,
->
{
with_feature_enabled
(
:merge_requests
)
}
scope
:with_merge_requests_enabled
,
->
{
with_feature_enabled
(
:merge_requests
)
}
scope
:with_remote_mirrors
,
->
{
joins
(
:remote_mirrors
).
where
(
remote_mirrors:
{
enabled:
true
}).
distinct
}
scope
:with_remote_mirrors
,
->
{
joins
(
:remote_mirrors
).
where
(
remote_mirrors:
{
enabled:
true
}).
distinct
}
scope
:with_grafana_integration_enabled
,
->
{
joins
(
:grafana_integration
).
where
(
grafana_integrations:
{
enabled:
true
})
}
scope
:with_group_runners_enabled
,
->
do
scope
:with_group_runners_enabled
,
->
do
joins
(
:ci_cd_settings
)
joins
(
:ci_cd_settings
)
...
...
lib/gitlab/grafana_embed_usage_data.rb
View file @
92de19ba
...
@@ -5,9 +5,9 @@ module Gitlab
...
@@ -5,9 +5,9 @@ module Gitlab
class
<<
self
class
<<
self
def
issue_count
def
issue_count
# rubocop:disable CodeReuse/ActiveRecord
# rubocop:disable CodeReuse/ActiveRecord
Issue
.
joins
(
project: :grafana_integration
)
Issue
.
joins
(
'JOIN grafana_integrations USING (project_id)'
)
.
merge
(
Project
.
with_grafana_integration_enabled
)
.
where
(
"issues.description LIKE '%' || grafana_integrations.grafana_url || '%'"
)
.
where
(
"issues.description LIKE '%' || grafana_integrations.grafana_url || '%'"
)
.
where
(
grafana_integrations:
{
enabled:
true
})
.
count
.
count
# rubocop:enable CodeReuse/ActiveRecord
# rubocop:enable CodeReuse/ActiveRecord
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment