gitlab-org--gitlab-foss/app/serializers/analytics_issue_entity.rb
Małgorzata Ksionek beaa635306 Add class for group level analytics
Add specs for group level

Update entities

Update base classes

Add groups-centric changes

Update plan and review stage

Add summary classes

Add summary spec

Update specs files

Add to specs test cases for group

Add changelog entry

Add group serializer

Fix typo

Fix typo

Add fetching namespace in sql query

Update specs

Add rubocop fix

Add rubocop fix

Modify method to be in sync with code review

Add counting deploys from subgroup

To group summary stage

Add subgroups handling

In group stage summary

Add additional spec

Add additional specs

Add more precise inheritance

Add attr reader to group level

Fix rubocop offence

Fix problems with specs

Add cr remarks

Renaming median method and a lot of calls in specs

Move spec setup

Rename method in specs

Add code review remarks regarding module

Add proper module name
2019-07-15 15:06:40 +02:00

31 lines
670 B
Ruby

# frozen_string_literal: true
class AnalyticsIssueEntity < Grape::Entity
include RequestAwareEntity
include EntityDateHelper
expose :title
expose :author, using: UserEntity
expose :iid do |object|
object[:iid].to_s
end
expose :total_time do |object|
distance_of_time_as_hash(object[:total_time].to_f)
end
expose(:created_at) do |object|
interval_in_words(object[:created_at])
end
expose :url do |object|
url_to(:namespace_project_issue, object)
end
private
def url_to(route, object)
public_send("#{route}_url", object[:path], object[:name], object[:iid].to_s) # rubocop:disable GitlabSecurity/PublicSend
end
end