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
894b88c8
Commit
894b88c8
authored
Mar 18, 2020
by
Shreyas Agarwal
Committed by
James Lopez
Mar 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send active users in seat link
parent
3850d88e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
10 deletions
+22
-10
ee/app/workers/sync_seat_link_request_worker.rb
ee/app/workers/sync_seat_link_request_worker.rb
+5
-4
ee/app/workers/sync_seat_link_worker.rb
ee/app/workers/sync_seat_link_worker.rb
+2
-1
ee/changelogs/unreleased/send-active-users-in-seat-link.yml
ee/changelogs/unreleased/send-active-users-in-seat-link.yml
+5
-0
ee/spec/workers/sync_seat_link_request_worker_spec.rb
ee/spec/workers/sync_seat_link_request_worker_spec.rb
+3
-2
ee/spec/workers/sync_seat_link_worker_spec.rb
ee/spec/workers/sync_seat_link_worker_spec.rb
+7
-3
No files found.
ee/app/workers/sync_seat_link_request_worker.rb
View file @
894b88c8
...
...
@@ -12,12 +12,12 @@ class SyncSeatLinkRequestWorker
RequestError
=
Class
.
new
(
StandardError
)
def
perform
(
date
,
license_key
,
max_historical_user_count
)
def
perform
(
date
,
license_key
,
max_historical_user_count
,
active_users
)
response
=
Gitlab
::
HTTP
.
post
(
URI_PATH
,
base_uri:
EE
::
SUBSCRIPTIONS_URL
,
headers:
request_headers
,
body:
request_body
(
date
,
license_key
,
max_historical_user_count
)
body:
request_body
(
date
,
license_key
,
max_historical_user_count
,
active_users
)
)
raise
RequestError
,
request_error_message
(
response
)
unless
response
.
success?
...
...
@@ -25,11 +25,12 @@ class SyncSeatLinkRequestWorker
private
def
request_body
(
date
,
license_key
,
max_historical_user_count
)
def
request_body
(
date
,
license_key
,
max_historical_user_count
,
active_users
)
{
date:
date
,
license_key:
license_key
,
max_historical_user_count:
max_historical_user_count
max_historical_user_count:
max_historical_user_count
,
active_users:
active_users
}.
to_json
end
...
...
ee/app/workers/sync_seat_link_worker.rb
View file @
894b88c8
...
...
@@ -18,7 +18,8 @@ class SyncSeatLinkWorker # rubocop:disable Scalability/IdempotentWorker
SyncSeatLinkRequestWorker
.
perform_async
(
report_date
.
to_s
,
License
.
current
.
data
,
max_historical_user_count
max_historical_user_count
,
HistoricalData
.
at
(
report_date
)
&
.
active_user_count
)
end
...
...
ee/changelogs/unreleased/send-active-users-in-seat-link.yml
0 → 100644
View file @
894b88c8
---
title
:
Send active users for each day in seat link POST request
merge_request
:
27481
author
:
type
:
changed
ee/spec/workers/sync_seat_link_request_worker_spec.rb
View file @
894b88c8
...
...
@@ -5,7 +5,7 @@ require 'spec_helper'
describe
SyncSeatLinkRequestWorker
,
type: :worker
do
describe
'#perform'
do
subject
do
described_class
.
new
.
perform
(
'2020-01-01'
,
'123'
,
5
)
described_class
.
new
.
perform
(
'2020-01-01'
,
'123'
,
5
,
4
)
end
let
(
:seat_link_url
)
{
[
EE
::
SUBSCRIPTIONS_URL
,
'/api/v1/seat_links'
].
join
}
...
...
@@ -20,7 +20,8 @@ describe SyncSeatLinkRequestWorker, type: :worker do
body:
{
date:
'2020-01-01'
,
license_key:
'123'
,
max_historical_user_count:
5
max_historical_user_count:
5
,
active_users:
4
}.
to_json
)
end
...
...
ee/spec/workers/sync_seat_link_worker_spec.rb
View file @
894b88c8
...
...
@@ -22,6 +22,7 @@ describe SyncSeatLinkWorker, type: :worker do
HistoricalData
.
create!
(
date:
'2020-02-12'
.
to_date
,
active_user_count:
10
)
HistoricalData
.
create!
(
date:
'2020-02-13'
.
to_date
,
active_user_count:
15
)
HistoricalData
.
create!
(
date:
'2020-03-11'
.
to_date
,
active_user_count:
10
)
HistoricalData
.
create!
(
date:
'2020-03-12'
.
to_date
,
active_user_count:
20
)
HistoricalData
.
create!
(
date:
'2020-03-15'
.
to_date
,
active_user_count:
25
)
allow
(
SyncSeatLinkRequestWorker
).
to
receive
(
:perform_async
).
and_return
(
true
)
...
...
@@ -35,7 +36,8 @@ describe SyncSeatLinkWorker, type: :worker do
.
with
(
'2020-03-11'
,
License
.
current
.
data
,
15
15
,
10
)
end
end
...
...
@@ -55,7 +57,8 @@ describe SyncSeatLinkWorker, type: :worker do
.
with
(
'2020-03-11'
,
License
.
current
.
data
,
15
15
,
10
)
end
end
...
...
@@ -75,7 +78,8 @@ describe SyncSeatLinkWorker, type: :worker do
.
with
(
'2020-03-11'
,
License
.
current
.
data
,
15
15
,
10
)
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