diff options
author | Małgorzata Ksionek <mksionek@gitlab.com> | 2019-07-16 17:17:21 +0200 |
---|---|---|
committer | Małgorzata Ksionek <mksionek@gitlab.com> | 2019-07-16 18:45:15 +0200 |
commit | 18535eb411887ac8283cc24b8ed1e384d3aabcc1 (patch) | |
tree | 7c08d43d993c463f7999099d31569175b86b1cf0 /app | |
parent | e6c61c89527eb1a8f0f8affff5a76c81af656d8e (diff) | |
download | gitlab-ce-18535eb411887ac8283cc24b8ed1e384d3aabcc1.tar.gz |
Add code review remarks
Change small things for better readability
Diffstat (limited to 'app')
-rw-r--r-- | app/models/cycle_analytics/group_level.rb | 11 | ||||
-rw-r--r-- | app/serializers/group_analytics_stage_entity.rb | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/app/models/cycle_analytics/group_level.rb b/app/models/cycle_analytics/group_level.rb index 35efd8b8809..508cde0ca00 100644 --- a/app/models/cycle_analytics/group_level.rb +++ b/app/models/cycle_analytics/group_level.rb @@ -3,19 +3,20 @@ module CycleAnalytics class GroupLevel include LevelBase - attr_reader :options + attr_reader :options, :group - def initialize(options:) - @options = options + def initialize(group:, options:) + @group = group + @options = options.merge(group: group) end def summary - @summary ||= ::Gitlab::CycleAnalytics::GroupStageSummary.new(options[:group], + @summary ||= ::Gitlab::CycleAnalytics::GroupStageSummary.new(group, from: options[:from], current_user: options[:current_user]).data end - def permissions(user: nil) + def permissions(*) STAGES.each_with_object({}) do |stage, obj| obj[stage] = true end diff --git a/app/serializers/group_analytics_stage_entity.rb b/app/serializers/group_analytics_stage_entity.rb index 019a3086f68..81be20e7dd8 100644 --- a/app/serializers/group_analytics_stage_entity.rb +++ b/app/serializers/group_analytics_stage_entity.rb @@ -9,7 +9,7 @@ class GroupAnalyticsStageEntity < Grape::Entity expose :description expose :group_median, as: :value do |stage| - # median returns a BatchLoader instance which we first have to unwrap by using to_f + # group_median returns a BatchLoader instance which we first have to unwrap by using to_f # we use to_f to make sure results below 1 are presented to the end-user stage.group_median.to_f.nonzero? ? distance_of_time_in_words(stage.group_median) : nil end |