2022-08-29 17:34:09 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Generate statistics indicators about projects
|
|
|
|
class Statistics::Builders::ProjectsBuilderService
|
|
|
|
include Statistics::Concerns::HelpersConcern
|
|
|
|
include Statistics::Concerns::ProjectsConcern
|
|
|
|
|
|
|
|
class << self
|
|
|
|
def build(options = default_options)
|
|
|
|
# project list
|
|
|
|
Statistics::FetcherService.projects_list(options).each do |p|
|
2022-09-05 16:29:01 +02:00
|
|
|
Stats::Project.create({ date: format_date(p[:date]),
|
2022-08-29 17:34:09 +02:00
|
|
|
type: 'project',
|
|
|
|
subType: 'published',
|
|
|
|
stat: 1 }.merge(user_info_stat(p)).merge(project_info_stat(p)))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|