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
b2779dac
Commit
b2779dac
authored
Sep 17, 2020
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Gitpod enabled user setting to Usage Data
parent
047a3c49
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
37 additions
and
1 deletion
+37
-1
app/models/user_preference.rb
app/models/user_preference.rb
+3
-0
changelogs/unreleased/242016-fj-add-user-preferences-gitpod-enabled-to-usage-data.yml
...-fj-add-user-preferences-gitpod-enabled-to-usage-data.yml
+5
-0
db/migrate/20200921093826_add_index_to_user_preferences.rb
db/migrate/20200921093826_add_index_to_user_preferences.rb
+17
-0
db/schema_migrations/20200921093826
db/schema_migrations/20200921093826
+1
-0
db/structure.sql
db/structure.sql
+2
-0
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+4
-1
spec/factories/usage_data.rb
spec/factories/usage_data.rb
+3
-0
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+1
-0
spec/support/helpers/usage_data_helpers.rb
spec/support/helpers/usage_data_helpers.rb
+1
-0
No files found.
app/models/user_preference.rb
View file @
b2779dac
...
...
@@ -8,6 +8,9 @@ class UserPreference < ApplicationRecord
belongs_to
:user
scope
:with_user
,
->
{
joins
(
:user
)
}
scope
:gitpod_enabled
,
->
{
where
(
gitpod_enabled:
true
)
}
validates
:issue_notes_filter
,
:merge_request_notes_filter
,
inclusion:
{
in:
NOTES_FILTERS
.
values
},
presence:
true
validates
:tab_width
,
numericality:
{
only_integer:
true
,
...
...
changelogs/unreleased/242016-fj-add-user-preferences-gitpod-enabled-to-usage-data.yml
0 → 100644
View file @
b2779dac
---
title
:
Add Gitpod enabled user setting to Usage Data
merge_request
:
42570
author
:
type
:
changed
db/migrate/20200921093826_add_index_to_user_preferences.rb
0 → 100644
View file @
b2779dac
# frozen_string_literal: true
class
AddIndexToUserPreferences
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_concurrent_index
:user_preferences
,
:gitpod_enabled
,
name: :index_user_preferences_on_gitpod_enabled
end
def
down
remove_concurrent_index
:user_preferences
,
:gitpod_enabled
,
name: :index_user_preferences_on_gitpod_enabled
end
end
db/schema_migrations/20200921093826
0 → 100644
View file @
b2779dac
8d14013bcb4d8302c91e331f619fb6f621ab79907aebc421d99c9484ecd7a5d8
\ No newline at end of file
db/structure.sql
View file @
b2779dac
...
...
@@ -21335,6 +21335,8 @@ CREATE UNIQUE INDEX index_user_interacted_projects_on_project_id_and_user_id ON
CREATE
INDEX
index_user_interacted_projects_on_user_id
ON
user_interacted_projects
USING
btree
(
user_id
);
CREATE
INDEX
index_user_preferences_on_gitpod_enabled
ON
user_preferences
USING
btree
(
gitpod_enabled
);
CREATE
UNIQUE
INDEX
index_user_preferences_on_user_id
ON
user_preferences
USING
btree
(
user_id
);
CREATE
INDEX
index_user_statuses_on_user_id
ON
user_statuses
USING
btree
(
user_id
);
...
...
lib/gitlab/usage_data.rb
View file @
b2779dac
...
...
@@ -445,8 +445,11 @@ module Gitlab
# rubocop: enable UsageData/LargeTable
# rubocop: enable CodeReuse/ActiveRecord
# augmented in EE
def
user_preferences_usage
{}
# augmented in EE
{
user_preferences_user_gitpod_enabled:
count
(
UserPreference
.
with_user
.
gitpod_enabled
.
merge
(
User
.
active
))
}
end
def
merge_requests_users
(
time_period
)
...
...
spec/factories/usage_data.rb
View file @
b2779dac
...
...
@@ -102,6 +102,9 @@ FactoryBot.define do
create
(
:package
,
project:
projects
[
1
])
create
(
:package
,
created_at:
2
.
months
.
ago
,
project:
projects
[
1
])
# User Preferences
create
(
:user_preference
,
gitpod_enabled:
true
)
ProjectFeature
.
first
.
update_attribute
(
'repository_access_level'
,
0
)
# Create fresh & a month (28-days SMAU) old data
...
...
spec/lib/gitlab/usage_data_spec.rb
View file @
b2779dac
...
...
@@ -499,6 +499,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
expect
(
count_data
[
:projects_with_packages
]).
to
eq
(
2
)
expect
(
count_data
[
:packages
]).
to
eq
(
4
)
expect
(
count_data
[
:user_preferences_user_gitpod_enabled
]).
to
eq
(
1
)
end
it
'gathers object store usage correctly'
do
...
...
spec/support/helpers/usage_data_helpers.rb
View file @
b2779dac
...
...
@@ -133,6 +133,7 @@ module UsageDataHelpers
todos
uploads
web_hooks
user_preferences_user_gitpod_enabled
)
.
push
(
*
SMAU_KEYS
)
USAGE_DATA_KEYS
=
%i(
...
...
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