forest_liana 8.0.6 → 8.0.7

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: 0ab34290d73cd66fa40aed2a7620e9638b93d3b4c9e569412f57cd073dda4925
4
- data.tar.gz: 5eedc8328ac380dc232c46ddc1be500b8068faebdde6c6fdbfc1967a5c3ae6c5
3
+ metadata.gz: b395f8136045929ee6e5610993210a7afa2fba21e386be617a9eb3b91e233ab7
4
+ data.tar.gz: f645d1f802cfc90d3cb4bdc13d9f83519140f19cfab90d441f2a06b2a3f6c5c8
5
5
  SHA512:
6
- metadata.gz: abdc878c4f8bca501c5dc7ecfdbea441e3ff497329661b050be832a794b7c72cf6012b48b8ab84cb8fc1b73fae5c9e5f9ead7c9e02d975a12588361e804d219d
7
- data.tar.gz: 92efd8362593ea90c03897983d102cbc60720c4c49e8bf4645c2b8ed3e9fbe4348f172b25efd89dfc593aa18192dfe2494daca1a53a69fdfa027f82be0ce7c2e
6
+ metadata.gz: 9c59fad452dc8275df24891f8b8daf471de210c3511a51eb067a1aee8b933dd6fa85cdfd23145bd638d4ab34e33cd56befe0b307d8ef29dda53b27f522864c47
7
+ data.tar.gz: e689c424aca159aa99debbb0a34c3b0e43c0f4542a8c696a083f196f20c28bca220dc4fef82f13b976a40ed919c0cea7c84df4f12ac33f0bfa588fd4c53a847e
@@ -114,9 +114,10 @@ module ForestLiana
114
114
  else
115
115
  from = to_client_timezone(duration.send(period).ago
116
116
  .send("beginning_of_#{period_of_time}"))
117
- to = to_client_timezone(1.send(period).ago
117
+ to = to_client_timezone(duration.send(period).ago
118
118
  .send("end_of_#{period_of_time}"))
119
119
  end
120
+
120
121
  "BETWEEN '#{from}' AND '#{to}'"
121
122
  end
122
123
 
@@ -151,9 +152,10 @@ module ForestLiana
151
152
  else
152
153
  from = to_client_timezone((duration * 2).send(period).ago
153
154
  .send("beginning_of_#{period_of_time}"))
154
- to = to_client_timezone((1 + duration).send(period).ago
155
+ to = to_client_timezone((duration * 2).send(period).ago
155
156
  .send("end_of_#{period_of_time}"))
156
157
  end
158
+
157
159
  "BETWEEN '#{from}' AND '#{to}'"
158
160
  end
159
161
 
@@ -1,3 +1,3 @@
1
1
  module ForestLiana
2
- VERSION = "8.0.6"
2
+ VERSION = "8.0.7"
3
3
  end
@@ -1,4 +1,6 @@
1
1
  module ForestLiana
2
+ include ActiveSupport::Testing::TimeHelpers
3
+
2
4
  describe FiltersParser do
3
5
  let(:timezone) { 'Europe/Paris' }
4
6
  let(:resource) { Tree }
@@ -488,5 +490,22 @@ module ForestLiana
488
490
 
489
491
  it { expect(filter_parser.apply_filters_on_previous_interval(date_condition_3).count).to eq 1 }
490
492
  end
493
+
494
+ describe 'parse_condition with time operator' do
495
+ let(:freeze_time) { Time.utc(2022, 5, 22, 0, 0, 0) }
496
+ before do
497
+ Timecop.freeze freeze_time
498
+ end
499
+
500
+ after do
501
+ Timecop.return
502
+ end
503
+
504
+ it 'parse_condition should return the correct query interval' do
505
+ res = filter_parser.parse_condition({ 'field' => 'created_at', 'operator' => 'previous_quarter', 'value' => nil })
506
+
507
+ expect(res[res.index('BETWEEN')..-1]).to eq "BETWEEN '2021-12-31 22:00:00 UTC' AND '2022-03-31 21:59:59 UTC'"
508
+ end
509
+ end
491
510
  end
492
511
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_liana
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.6
4
+ version: 8.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Munda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-05 00:00:00.000000000 Z
11
+ date: 2023-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails