forest_liana 8.0.5 → 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: 4b5358e0a8b103d87676b9f02ba9de7dbb35670f5a03f6dc4fd7f50d44f2424a
4
- data.tar.gz: bf58dd7d9f38ba77f1bb6317f55179a6fb42babae5b6a5b56b9c282d2e0d79f3
3
+ metadata.gz: b395f8136045929ee6e5610993210a7afa2fba21e386be617a9eb3b91e233ab7
4
+ data.tar.gz: f645d1f802cfc90d3cb4bdc13d9f83519140f19cfab90d441f2a06b2a3f6c5c8
5
5
  SHA512:
6
- metadata.gz: 0cfdec294649ddbfddf873de76ff961db3eeda40afa6a84ad679f71bddae9dd0fc16fd1d5d9992121ecfebcf335a73a11d95c893d9232b8a2e3f4fdecbb5c073
7
- data.tar.gz: f30bb2f41054e24d88af4cf966fd7b836c4a227f1e053431769af623160ee734eacdc42e7f93d98fea729e97252b1860988e5b704fdaf0291ffa1226918c0751
6
+ metadata.gz: 9c59fad452dc8275df24891f8b8daf471de210c3511a51eb067a1aee8b933dd6fa85cdfd23145bd638d4ab34e33cd56befe0b307d8ef29dda53b27f522864c47
7
+ data.tar.gz: e689c424aca159aa99debbb0a34c3b0e43c0f4542a8c696a083f196f20c28bca220dc4fef82f13b976a40ed919c0cea7c84df4f12ac33f0bfa588fd4c53a847e
@@ -1,5 +1,5 @@
1
1
  module ForestLiana
2
- class ActionsController < ApplicationController
2
+ class ActionsController < ForestLiana::ApplicationController
3
3
 
4
4
  def get_smart_action_hook_request
5
5
  if params[:data] && params[:data][:attributes] && params[:data][:attributes][:collection_name]
@@ -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.5"
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.5
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-04 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