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
5c9ac560
Commit
5c9ac560
authored
Oct 05, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce all_state_names so that we could avoid NOT IN
parent
aafb0171
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
app/models/commit_status.rb
app/models/commit_status.rb
+2
-2
app/models/concerns/has_status.rb
app/models/concerns/has_status.rb
+4
-0
No files found.
app/models/commit_status.rb
View file @
5c9ac560
...
@@ -32,8 +32,8 @@ class CommitStatus < ActiveRecord::Base
...
@@ -32,8 +32,8 @@ class CommitStatus < ActiveRecord::Base
scope
:exclude_ignored
,
->
do
scope
:exclude_ignored
,
->
do
quoted_when
=
connection
.
quote_column_name
(
'when'
)
quoted_when
=
connection
.
quote_column_name
(
'when'
)
# We want to ignore failed_but_allowed jobs
# We want to ignore failed_but_allowed jobs
where
(
"allow_failure = ? OR status
NOT
IN (?)"
,
where
(
"allow_failure = ? OR status IN (?)"
,
false
,
[
:failed
,
:canceled
])
.
false
,
all_state_names
-
[
:failed
,
:canceled
])
.
# We want to ignore skipped manual jobs
# We want to ignore skipped manual jobs
where
(
"
#{
quoted_when
}
<> ? OR status <> ?"
,
'manual'
,
'skipped'
)
.
where
(
"
#{
quoted_when
}
<> ? OR status <> ?"
,
'manual'
,
'skipped'
)
.
# We want to ignore skipped on_failure
# We want to ignore skipped on_failure
...
...
app/models/concerns/has_status.rb
View file @
5c9ac560
...
@@ -43,6 +43,10 @@ module HasStatus
...
@@ -43,6 +43,10 @@ module HasStatus
def
finished_at
def
finished_at
all
.
maximum
(
:finished_at
)
all
.
maximum
(
:finished_at
)
end
end
def
all_state_names
state_machines
.
values
.
flat_map
(
&
:states
).
flat_map
{
|
s
|
s
.
map
(
&
:name
)
}
end
end
end
included
do
included
do
...
...
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