diff options
author | James Lopez <james@jameslopez.es> | 2016-11-21 17:15:25 +0100 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2017-01-17 11:32:54 +0100 |
commit | a998276223510ceee67f686dfc3ef536c0252c5a (patch) | |
tree | dbc30d5ef3b26fcad6c856c7741d8d32cccf7b23 /app/serializers | |
parent | 3268e3779166c7ddf47ecc0d78397cd75cf2f0e8 (diff) | |
download | gitlab-ce-a998276223510ceee67f686dfc3ef536c0252c5a.tar.gz |
added analytics stage serializer and moved some info to the stage classes from the controller
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/analytics_stage_entity.rb | 12 | ||||
-rw-r--r-- | app/serializers/analytics_stage_serializer.rb | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/app/serializers/analytics_stage_entity.rb b/app/serializers/analytics_stage_entity.rb new file mode 100644 index 00000000000..72a587c8c1d --- /dev/null +++ b/app/serializers/analytics_stage_entity.rb @@ -0,0 +1,12 @@ +class AnalyticsStageEntity < Grape::Entity + include EntityDateHelper + + expose :stage, as: :title do |object| + object[:stage].to_s.capitalize + end + expose :description + + expose :median, as: :value do |stage| + stage[:median] && !stage[:median].zero? ? distance_of_time_in_words(stage[:median]) : nil + end +end diff --git a/app/serializers/analytics_stage_serializer.rb b/app/serializers/analytics_stage_serializer.rb new file mode 100644 index 00000000000..613cf6874d8 --- /dev/null +++ b/app/serializers/analytics_stage_serializer.rb @@ -0,0 +1,3 @@ +class AnalyticsStageSerializer < BaseSerializer + entity AnalyticsStageEntity +end |