Sha256: 1ae9725c58ea06cde77271261605b6157e63b90de7df441ea5e82a387b1f2fcb
Contents?: true
Size: 751 Bytes
Versions: 4
Compression:
Stored size: 751 Bytes
Contents
module Repor module Dimensions class CategoryDimension < BaseDimension def filter(relation) values = filter_values query = "#{expression} IN (?)" query = "#{expression} IS NULL OR #{query}" if values.include?(nil) relation.where(query, values.compact) end def group(relation) order relation.select("#{expression} AS #{sql_value_name}").group(sql_value_name) end def group_values if filtering? filter_values else i = report.groupers.index(self) report.raw_data.map { |x, _y| x[i] }.uniq end end def all_values relate(report.base_relation).pluck("DISTINCT #{expression}") end end end end
Version data entries
4 entries across 4 versions & 1 rubygems