simple_drilldown 0.14.0 → 0.14.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ca344402dbcb15946fe11948f5548b6802df4d50f97b8a6c596c10728b1f8c0
4
- data.tar.gz: af4df3909a14d2d7dcf6ba4838d6585ca0947dce7139247316aa49b4cdc3b803
3
+ metadata.gz: ef72a1d7f488dd64e45e610dafbef583ed0be5c3e65ae1a4fe024350efc5bde9
4
+ data.tar.gz: 356bbee827c123946e2ec7d75891b81454f862ed57d1ba88bddc210b47e94884
5
5
  SHA512:
6
- metadata.gz: 72502b99cd7db75b86b75d42a0b89210e0836c4357f75f56636f22a763cf5f8f2bb48ef8b23acd84ad3125e2d36a7ac5a99f3fd86379d574e0b2c19d0b957ab3
7
- data.tar.gz: fb60b7c5f49a48bd04160e2ce4f522dea38fa8794d402ed2356631a2e17ef5dabbc95268118d288beb41f8b15119ae9dea14b58804b18b6b4ad16b6025c1079c
6
+ metadata.gz: f3a2390ecacca9bd85ce30e768aa662917f4b165df4f77e45cccfbb3201cb43548bc4cfd21052d0e835f1ed58a1770dd3d92f66283792aed86f5001e3171676b
7
+ data.tar.gz: ee791c11f609c1ca18dd95405c80be69c73e7a8ba79ba4cb4b4dd32164f49f93224f2a22ec8e452aeb71ccf60c709e66ae00a7f4433c587ab25d97c2b08979b0
@@ -155,7 +155,7 @@ module SimpleDrilldown
155
155
  dimension_def = c_dimension_defs[field.to_s]
156
156
  result_sets = dimension_def[:queries].map do |query|
157
157
  includes = merge_includes(includes, query[:includes]) if query[:includes]
158
- rows_query = c_target_class.unscoped.where(c_base_condition)
158
+ rows_query = c_target_class.unscoped.where(realized_where(c_base_condition))
159
159
  .select("#{query[:select]} AS value")
160
160
  .joins(make_join([], c_target_class.name.underscore.to_sym, includes))
161
161
  .order('value')
@@ -163,7 +163,7 @@ module SimpleDrilldown
163
163
  rows_query = rows_query.without_deleted if c_target_class.try :paranoid?
164
164
  rows_query = rows_query.where(filter_conditions) if filter_conditions
165
165
  if (where = query[:where])
166
- where_mapped = where.map { |e| e.respond_to?(:call) ? e.call : e }
166
+ where_mapped = realized_where(where)
167
167
  rows_query = rows_query.where(where_mapped)
168
168
  end
169
169
  rows = rows_query.to_a
@@ -184,6 +184,15 @@ module SimpleDrilldown
184
184
  end
185
185
  end
186
186
 
187
+ def realized_where(where)
188
+ case where
189
+ when Array
190
+ where.map { |e| e.respond_to?(:call) ? e.call : e }
191
+ else
192
+ where
193
+ end
194
+ end
195
+
187
196
  def make_conditions(search_filter)
188
197
  includes = c_base_includes.dup
189
198
  if search_filter
@@ -393,7 +402,7 @@ module SimpleDrilldown
393
402
  group = nil if group.empty?
394
403
 
395
404
  joins = self.class.make_join([], c_target_class.name.underscore.to_sym, includes)
396
- row_query = c_target_class.unscoped.where(c_base_condition).select(select)
405
+ row_query = c_target_class.unscoped.where(self.class.realized_where(c_base_condition)).select(select)
397
406
  row_query = row_query.where(conditions) if conditions
398
407
  rows = row_query.joins(joins).group(group).order(order).to_a
399
408
  if rows.empty?
@@ -598,7 +607,8 @@ module SimpleDrilldown
598
607
  end
599
608
  joins = self.class.make_join([], c_target_class.name.underscore.to_sym, list_includes)
600
609
  list_conditions = list_conditions(conditions, values)
601
- base_query = c_target_class.unscoped.where(c_base_condition).joins(joins).order(c_list_order)
610
+ base_query = c_target_class.unscoped.where(self.class.realized_where(c_base_condition)).joins(joins)
611
+ .order(c_list_order)
602
612
  base_query = base_query.where(list_conditions) if list_conditions
603
613
  result[:records] = base_query.to_a
604
614
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SimpleDrilldown
4
- VERSION = '0.14.0'
4
+ VERSION = '0.14.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_drilldown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uwe Kubosch