summaryrefslogtreecommitdiff
path: root/app/serializers
diff options
context:
space:
mode:
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/analytics_stage_entity.rb12
-rw-r--r--app/serializers/analytics_stage_serializer.rb3
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