netzke-basepack 0.8.3 → 0.8.4

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
  SHA1:
3
- metadata.gz: 1cf0253e7faf8d9b55ec4d2fa9ce2cadbbd67001
4
- data.tar.gz: 160491e2c4291ac17a98587f1bafc23c41b5d372
3
+ metadata.gz: 5c6fa2322cb559185c96b7c94bc81b5ac2659c11
4
+ data.tar.gz: 81749e01b515bc0d9048cbe416ff5d4e04883123
5
5
  SHA512:
6
- metadata.gz: 0bd90a75392a7a98308282006b47d2d2eb33d4d3769eab68f6873d7ffa707dea63c3201b9bd970ed7f47e0c3bdf1ec36bb834c09f836036d70a64d10159f1e4d
7
- data.tar.gz: b2fd784bff28d8f61b42e5f340d6e0ff5144bb4d3347c4621b529c30abbeae13b41e01cd882e452548873f65fddc927215a54e7c00e87bca9a3eb71f2dbc5170
6
+ metadata.gz: e25dfd01b65fabf7d9965319eb195e3bf62d08bf5135e420fc1e29685220366a676d5b6f66f02e2b884f5c5d34b368dba07308c3d09138d6f3f67469768e6ad4
7
+ data.tar.gz: d20dde81ffbc3ad01fe891e5671d262a3f3fae50a1b0872e0e7e0825991e6b5951794b0f668622843d3b299d70460fefafbc45b8ee934a38fa035d5d750769e8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.8.4 - 2013-05-22
2
+ * bug fix
3
+ * the 'on' filter on date works again (thanks Simon Willmann)
4
+
1
5
  # 0.8.3 - 2013-04-24
2
6
  * improvements
3
7
  * implement advanced searching by association (issue #93)
@@ -370,6 +370,9 @@ module Netzke::Basepack::DataAdapters
370
370
  value = v["value"]
371
371
  op = v['comparison']
372
372
 
373
+ # safety
374
+ raise "Invalid filter operator '#{op}'" unless op.blank? || %w(lt gt lteq gteq eq contains).include?(op)
375
+
373
376
  col_filter = @cls.inject(nil) { |fil, col|
374
377
  if col.is_a?(Hash) && col[:filter_with] && col[:name].to_sym == v['field'].to_sym
375
378
  fil = col[:filter_with]
@@ -382,7 +385,6 @@ module Netzke::Basepack::DataAdapters
382
385
  next
383
386
  end
384
387
 
385
-
386
388
  case v["type"]
387
389
  when "string"
388
390
  res = res.where(arel_table[field].matches("%#{value}%"))
@@ -390,8 +392,8 @@ module Netzke::Basepack::DataAdapters
390
392
  # convert value to the DB date
391
393
  value.match(/(\d\d)\/(\d\d)\/(\d\d\d\d)/)
392
394
  if op == 'eq'
393
- res = res.where(arel_table[field].ge("#{$3}-#{$1}-#{$2}".to_date.beginning_of_day))
394
- res = res.where(arel_table[field].le("#{$3}-#{$1}-#{$2}".to_date.end_of_day))
395
+ res = res.where(arel_table[field].gteq("#{$3}-#{$1}-#{$2}".to_date.beginning_of_day))
396
+ res = res.where(arel_table[field].lteq("#{$3}-#{$1}-#{$2}".to_date.end_of_day))
395
397
  else
396
398
  res = res.where(arel_table[field].send(op, "#{$3}-#{$1}-#{$2}".to_time))
397
399
  end
@@ -3,7 +3,7 @@ module Netzke
3
3
  module Version
4
4
  MAJOR = 0
5
5
  MINOR = 8
6
- PATCH = 3
6
+ PATCH = 4
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
9
9
  end
Binary file
@@ -15,46 +15,50 @@ Background:
15
15
 
16
16
  @javascript
17
17
  Scenario: Numeric and text filter
18
+ # Note that it's important to build the scenario so that the filtering results are always changing, showing a different
19
+ # amount of records each time. Otherwise we may not catch a server exception, when the number of records wouldn't change
20
+ # either.
18
21
  When I go to the BookGridFiltering test page
19
22
  And I enable filter on column "exemplars" with value "{gt:6}"
20
23
  Then the grid should show 1 records
21
24
 
22
- When I clear all filters in the grid
23
- And I enable filter on column "exemplars" with value "{eq:5}"
24
- Then the grid should show 1 records
25
-
26
25
  When I clear all filters in the grid
27
26
  And I enable filter on column "exemplars" with value "{eq:6}"
28
27
  Then the grid should show 0 records
29
28
 
29
+ When I clear all filters in the grid
30
+ And I enable filter on column "exemplars" with value "{eq:5}"
31
+ Then the grid should show 1 records
32
+
30
33
  # NOTE: due to some mystery, this wouldn't work in a separate scenario (e.g. "Text filter")
31
34
  # That is, the filter just wouldn't get set.
32
35
  When I clear all filters in the grid
33
36
  And I enable filter on column "notes" with value "'read'"
34
37
  Then the grid should show 2 records
35
38
 
36
- When I clear all filters in the grid
37
- And I enable filter on column "author__first_name" with value "'d'"
38
- Then the grid should show 2 records
39
-
40
39
  When I clear all filters in the grid
41
40
  And I enable filter on column "author__first_name" with value "'carl'"
42
41
  Then the grid should show 1 records
43
42
 
44
43
  When I clear all filters in the grid
44
+ And I enable filter on column "author__first_name" with value "'d'"
45
+ Then the grid should show 2 records
46
+
47
+ When I clear all filters in the grid
48
+ And I wait for response from server
45
49
  And I enable date filter on column "last_read_at" with value "on 04/25/2011"
46
50
  Then the grid should show 1 records
47
51
 
48
52
  When I clear all filters in the grid
49
- And I enable date filter on column "last_read_at" with value "after 04/25/2011"
50
- Then the grid should show 1 records
53
+ And I enable date filter on column "last_read_at" with value "after 12/23/2010"
54
+ Then the grid should show 2 records
51
55
 
52
56
  When I clear all filters in the grid
53
- And I enable date filter on column "last_read_at" with value "before 12/24/2010"
57
+ And I enable date filter on column "last_read_at" with value "after 04/25/2011"
54
58
  Then the grid should show 1 records
55
59
 
56
60
  When I clear all filters in the grid
57
- And I enable date filter on column "last_read_at" with value "after 12/23/2010"
61
+ And I enable date filter on column "last_read_at" with value "before 04/26/2011"
58
62
  Then the grid should show 2 records
59
63
 
60
64
  When I clear all filters in the grid