diff options
author | James Lopez <james@jameslopez.es> | 2016-11-15 13:36:39 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-11-17 10:22:58 +0300 |
commit | 8743e59f78cd8f8701460796dcc06854281f3f73 (patch) | |
tree | d539fff96a88a8ea33f1a9ab62faffc678dd22d8 /app/serializers/analytics_build_entity.rb | |
parent | f5600997512f1068cdc36ad7d086e7447dbc6d9d (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.rb | 11 |
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 |