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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
87a43799
Commit
87a43799
authored
Jan 03, 2018
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify metrics fetching for closed/merged MRs
parent
feee48a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
app/serializers/merge_request_widget_entity.rb
app/serializers/merge_request_widget_entity.rb
+5
-6
No files found.
app/serializers/merge_request_widget_entity.rb
View file @
87a43799
...
...
@@ -187,12 +187,11 @@ class MergeRequestWidgetEntity < IssuableEntity
def
build_metrics
(
merge_request
)
# There's no need to query and serialize metrics data for merge requests that are not
# merged or closed.
case
merge_request
.
state
when
'merged'
merge_request
.
metrics
&
.
merged_by_id
?
merge_request
.
metrics
:
build_metrics_from_events
(
merge_request
)
when
'closed'
merge_request
.
metrics
&
.
latest_closed_by_id
?
merge_request
.
metrics
:
build_metrics_from_events
(
merge_request
)
end
return
unless
merge_request
.
merged?
||
merge_request
.
closed?
return
merge_request
.
metrics
if
merge_request
.
merged?
&&
merge_request
.
metrics
&
.
merged_by_id
return
merge_request
.
metrics
if
merge_request
.
closed?
&&
merge_request
.
metrics
&
.
latest_closed_by_id
build_metrics_from_events
(
merge_request
)
end
def
build_metrics_from_events
(
merge_request
)
...
...
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