simple_drilldown 0.14.0 → 0.14.2

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: 2a4c733a59b4e632b71fa7752a8d19f4fc47dde7868cf013e0bdbf896276e98f
4
+ data.tar.gz: 3f7350f9f4d88c14a5351158705400110fe57f9e7f1c03bd84c65fd7603b0290
5
5
  SHA512:
6
- metadata.gz: 72502b99cd7db75b86b75d42a0b89210e0836c4357f75f56636f22a763cf5f8f2bb48ef8b23acd84ad3125e2d36a7ac5a99f3fd86379d574e0b2c19d0b957ab3
7
- data.tar.gz: fb60b7c5f49a48bd04160e2ce4f522dea38fa8794d402ed2356631a2e17ef5dabbc95268118d288beb41f8b15119ae9dea14b58804b18b6b4ad16b6025c1079c
6
+ metadata.gz: 18c58a49d658729ae364559a55cf59e9677e8ff7d20a5ad3d4e8b8ea7cbff7f69b309bfd717e75394e002322eff22f15878ee37ee15677a515feb0f05b95e832
7
+ data.tar.gz: 635d388bed35d0b91e83d2676093178d9ed8bb767325ecdbcbb9c519c81bb43bf9bb082797be85bdd424050f5b18918ec79a72c0fd885deb8efc7adc3c48ffc7
@@ -87,11 +87,11 @@
87
87
  firstPoint = chart.getElementsAtEventForMode(e, 'nearest', { intersect: true }, false)[0]
88
88
  if (firstPoint) {
89
89
  label = chart.data.labels[firstPoint.index];
90
- value = chart.data.datasets[firstPoint.datasetIndex].data[firstPoint._index];
91
- console.log("Label: " + label + ", Value: " + value);
92
- new_location = window.location.toString();
90
+ console.log("Label: " + label);
91
+ new_location = decodeURI(window.location.toString());
93
92
  new_location = new_location.replace(/#.*$/, '');
94
93
  new_location = new_location.replace("&search[dimensions][]=<%= @dimensions[0][:url_param_name] %>", '');
94
+ new_location = new_location.replaceAll(/&search\[filter\]\[<%= @dimensions[0][:url_param_name] %>\]\[\]=[^&#]*/g, '');
95
95
  new_location = new_location + '&search[filter][<%= @dimensions[0][:url_param_name] %>][]=' + label;
96
96
  console.log(new_location);
97
97
  window.location = new_location;
@@ -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.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uwe Kubosch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-28 00:00:00.000000000 Z
11
+ date: 2022-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: caxlsx_rails