Sha256: 76dc3a364cb0bc32236e8672840b06787f846afdc61a04e0177cfd8b3e05289f
Contents?: true
Size: 878 Bytes
Versions: 15
Compression:
Stored size: 878 Bytes
Contents
# frozen_string_literal: true module Decidim module TermCustomizer # This query class filters all assemblies given an organization. class OrganizationTranslationSets < Rectify::Query def initialize(organization) @organization = organization end def query columns = [ "DISTINCT(decidim_term_customizer_translation_sets.id)", "name", "name->>'#{current_locale}' AS local_name" ] q = Decidim::TermCustomizer::TranslationSet.joins(:constraints).where( decidim_term_customizer_constraints: { decidim_organization_id: @organization.id } ).select(columns.join(",")) q.order("local_name") end def count query.count(:id) end private def current_locale I18n.locale.to_s end end end end
Version data entries
15 entries across 15 versions & 1 rubygems