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
0652247a
Commit
0652247a
authored
Jun 30, 2021
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused with_active_integrations scope
parent
af2320c7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
16 deletions
+5
-16
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+0
-1
ee/spec/models/project_spec.rb
ee/spec/models/project_spec.rb
+0
-10
lib/gitlab/database/batch_count.rb
lib/gitlab/database/batch_count.rb
+1
-1
lib/gitlab/database/postgres_hll/batch_distinct_counter.rb
lib/gitlab/database/postgres_hll/batch_distinct_counter.rb
+4
-4
No files found.
ee/app/models/ee/project.rb
View file @
0652247a
...
...
@@ -144,7 +144,6 @@ module EE
scope
:for_plan_name
,
->
(
name
)
{
joins
(
namespace:
{
gitlab_subscription: :hosted_plan
}).
where
(
plans:
{
name:
name
})
}
scope
:requiring_code_owner_approval
,
->
{
joins
(
:protected_branches
).
where
(
protected_branches:
{
code_owner_approval_required:
true
})
}
scope
:with_active_integrations
,
->
{
joins
(
:integrations
).
merge
(
::
Integration
.
active
)
}
scope
:github_imported
,
->
{
where
(
import_type:
'github'
)
}
scope
:with_protected_branches
,
->
{
joins
(
:protected_branches
)
}
scope
:with_repositories_enabled
,
->
{
joins
(
:project_feature
).
where
(
project_features:
{
repository_access_level:
::
ProjectFeature
::
ENABLED
})
}
...
...
ee/spec/models/project_spec.rb
View file @
0652247a
...
...
@@ -281,16 +281,6 @@ RSpec.describe Project do
end
end
describe
'.with_active_integrations'
do
it
'returns the correct project'
do
active
=
create
(
:service
,
active:
true
)
inactive
=
create
(
:service
,
active:
false
)
expect
(
described_class
.
with_active_integrations
).
to
include
(
active
.
project
)
expect
(
described_class
.
with_active_integrations
).
not_to
include
(
inactive
.
project
)
end
end
describe
'.github_imported'
do
it
'returns the correct project'
do
project_imported_from_github
=
create
(
:project
,
:github_imported
)
...
...
lib/gitlab/database/batch_count.rb
View file @
0652247a
...
...
@@ -18,7 +18,7 @@
# batch_count(::Clusters::Cluster.aws_installed.enabled, :cluster_id)
# batch_count(Namespace.group(:type))
# batch_distinct_count(::Project, :creator_id)
# batch_distinct_count(::Project.
with_active_integrations
.service_desk_enabled.where(time_period), start: ::User.minimum(:id), finish: ::User.maximum(:id))
# batch_distinct_count(::Project.
aimed_for_deletion
.service_desk_enabled.where(time_period), start: ::User.minimum(:id), finish: ::User.maximum(:id))
# batch_distinct_count(Project.group(:visibility_level), :creator_id)
# batch_sum(User, :sign_in_count)
# batch_sum(Issue.group(:state_id), :weight))
...
...
lib/gitlab/database/postgres_hll/batch_distinct_counter.rb
View file @
0652247a
...
...
@@ -11,17 +11,17 @@ module Gitlab
# In order to not use a possible complex time consuming query when calculating min and max values,
# the start and finish can be sent specifically, start and finish should contain max and min values for PRIMARY KEY of
# relation (most cases `id` column) rather than counted attribute eg:
# estimate_distinct_count(start: ::Project.
with_active_integrations.minimum(:id), finish: ::Project.with_active_integrations
.maximum(:id))
# estimate_distinct_count(start: ::Project.
aimed_for_deletion.minimum(:id), finish: ::Project.aimed_for_deletion
.maximum(:id))
#
# Grouped relations are NOT supported yet.
#
# @example Usage
# ::Gitlab::Database::PostgresHllBatchDistinctCount.new(::Project, :creator_id).execute
# ::Gitlab::Database::PostgresHllBatchDistinctCount.new(::Project.
with_active_integrations
.service_desk_enabled.where(time_period))
# ::Gitlab::Database::PostgresHllBatchDistinctCount.new(::Project.
aimed_for_deletion
.service_desk_enabled.where(time_period))
# .execute(
# batch_size: 1_000,
# start: ::Project.
with_active_integrations
.service_desk_enabled.where(time_period).minimum(:id),
# finish: ::Project.
with_active_integrations
.service_desk_enabled.where(time_period).maximum(:id)
# start: ::Project.
aimed_for_deletion
.service_desk_enabled.where(time_period).minimum(:id),
# finish: ::Project.
aimed_for_deletion
.service_desk_enabled.where(time_period).maximum(:id)
# )
#
# @note HyperLogLog is an PROBABILISTIC algorithm that ESTIMATES distinct count of given attribute value for supplied relation
...
...
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