diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-02-09 17:10:58 +0300 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-02-28 13:46:19 +0300 |
commit | 7c109c575016eb0596e20180b334ca2955bd33e6 (patch) | |
tree | a24bcb16fea7c81b30d3fe7d3d2292d2a90d3295 /app/serializers | |
parent | a7b3f11edd626b7ba2fe4101951d2c9fe884b04a (diff) |
Refactor CycleAnalytics base stage class and model
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/analytics_stage_entity.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/serializers/analytics_stage_entity.rb b/app/serializers/analytics_stage_entity.rb index 564612202b5..ed1103b2064 100644 --- a/app/serializers/analytics_stage_entity.rb +++ b/app/serializers/analytics_stage_entity.rb @@ -6,7 +6,13 @@ class AnalyticsStageEntity < Grape::Entity expose :legend expose :description - expose :median, as: :value do |stage| - stage.median && !stage.median.zero? ? distance_of_time_in_words(stage.median) : nil + expose :medians, as: :values do |stage| + medians = stage.medians + + unless medians.blank? + medians.each do |id, median| + medians[id] = distance_of_time_in_words(median) + end + end end end |