Sha256: b95ac0e673b6909b8a2af361968e1b1ec66db7ca95bd9016f1dff94e26ceaaa1

Contents?: true

Size: 950 Bytes

Versions: 9

Compression:

Stored size: 950 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # A Metric is a registry that holds cumulative and quantity value by day, category, participatory_space, category, an a related object
  class Metric < ApplicationRecord
    # ParticipatorySpace, RelatedObject and Category are optional relationships because not all metric objects need them
    # For example, User is only related to an organization, but a Proposal can have all of them
    belongs_to :organization, foreign_key: "decidim_organization_id", class_name: "Decidim::Organization"
    belongs_to :participatory_space, foreign_key: "participatory_space_id", foreign_type: "participatory_space_type", polymorphic: true, optional: true
    belongs_to :related_object, foreign_key: "related_object_id", foreign_type: "related_object_type", polymorphic: true, optional: true
    belongs_to :category, foreign_key: "decidim_category_id", class_name: "Decidim::Category", optional: true
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
decidim-core-0.17.2 app/models/decidim/metric.rb
decidim-core-0.18.0 app/models/decidim/metric.rb
decidim-core-0.17.1 app/models/decidim/metric.rb
decidim-core-0.16.1 app/models/decidim/metric.rb
decidim-core-0.17.0 app/models/decidim/metric.rb
decidim-core-0.16.0 app/models/decidim/metric.rb
decidim-core-0.15.2 app/models/decidim/metric.rb
decidim-core-0.15.1 app/models/decidim/metric.rb
decidim-core-0.15.0 app/models/decidim/metric.rb