Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-11-15 13:36:39 +0300
committerJames Lopez <james@jameslopez.es>2016-11-17 10:22:58 +0300
commit8743e59f78cd8f8701460796dcc06854281f3f73 (patch)
treed539fff96a88a8ea33f1a9ab62faffc678dd22d8 /app/serializers/analytics_build_entity.rb
parentf5600997512f1068cdc36ad7d086e7447dbc6d9d (diff)
get all stages to use serlalizers - apart from plan - WIP
Diffstat (limited to 'app/serializers/analytics_build_entity.rb')
-rw-r--r--app/serializers/analytics_build_entity.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/serializers/analytics_build_entity.rb b/app/serializers/analytics_build_entity.rb
index a07f0beccd4..eb1eef3424a 100644
--- a/app/serializers/analytics_build_entity.rb
+++ b/app/serializers/analytics_build_entity.rb
@@ -1,14 +1,21 @@
class AnalyticsBuildEntity < Grape::Entity
include RequestAwareEntity
+ include EntityDateHelper
expose :name
expose :id
expose :ref, as: :branch
expose :short_sha
- expose :started_at, as: :date
- expose :duration, as: :total_time
expose :author, using: UserEntity
+ expose :started_at, as: :date do |build|
+ interval_in_words(build[:started_at])
+ end
+
+ expose :duration, as: :total_time do |build|
+ distance_of_time_in_words(build[:duration].to_f)
+ end
+
expose :branch do
expose :ref, as: :name