Commit 13d009ce authored by Lin Jen-Shin's avatar Lin Jen-Shin

Prefer oneline and Rubocop prefers ternary operator

Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8286/diffs#note_20433402
parent b63f2794
...@@ -93,13 +93,8 @@ module Ci ...@@ -93,13 +93,8 @@ module Ci
.select("max(#{quoted_table_name}.id)") .select("max(#{quoted_table_name}.id)")
.group(:ref, :sha) .group(:ref, :sha)
query = if ref relation = ref ? where(ref: ref) : self
where(id: max_id, ref: ref) relation.where(id: max_id).order(id: :desc)
else
where(id: max_id)
end
query.order(id: :desc)
end end
def self.latest_status(ref = nil) def self.latest_status(ref = nil)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment