Commit a32dd93a authored by James Lopez's avatar James Lopez

fix started_at check

parent 94a74e79
...@@ -13,7 +13,7 @@ class AnalyticsBuildEntity < Grape::Entity ...@@ -13,7 +13,7 @@ class AnalyticsBuildEntity < Grape::Entity
end end
expose :duration, as: :total_time do |build| expose :duration, as: :total_time do |build|
build_started?(build) ? distance_of_time_as_hash(build.duration.to_f) : {} build.duration ? distance_of_time_as_hash(build.duration.to_f) : {}
end end
expose :branch do expose :branch do
...@@ -37,8 +37,4 @@ class AnalyticsBuildEntity < Grape::Entity ...@@ -37,8 +37,4 @@ class AnalyticsBuildEntity < Grape::Entity
def url_to(route, build, id = nil) def url_to(route, build, id = nil)
public_send("#{route}_url", build.project.namespace, build.project, id || build) public_send("#{route}_url", build.project.namespace, build.project, id || build)
end end
def build_started?(build)
build.duration && build[:started_at]
end
end end
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