Sha256: f166a2efb5727be448536cdfb4f5b8333d7239c785f1e2658807ae6efe4c64f5
Contents?: true
Size: 807 Bytes
Versions: 1
Compression:
Stored size: 807 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}"). map(&method(:sanitize_sql_value)) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
repor-0.1.0 | lib/repor/dimensions/category_dimension.rb |