state_of_the_nation 1.1.5 → 1.1.6

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: 02ade11e55bbaf4cb8e730d260c73976d9342aa13dd5002d64350e58be94aea7
4
- data.tar.gz: 41d55f54645e8fd974e1470494f70ab68bcd6db46c1c81346af2884d98e60137
3
+ metadata.gz: fc3cdbd88385c581951562d576585cc78ff3528de59b908b280ad331c4794bc4
4
+ data.tar.gz: 4a41b1f65f1d1e517568deb529e1fdfaaae033a561d5b2d8b660a49588590c64
5
5
  SHA512:
6
- metadata.gz: 6db7e850c08dda81286a85655516de4e13c57872ef23709875a268a86c41e8548ae1fd6ccb6b416a184ef2de272956dc6783cda7022116e0b2d494de45698194
7
- data.tar.gz: e9b03e89653353fd344bfa71ce9538c1abdab8e93afd8611d359be0c8c0c005a60732de7dfa4310530fa5f942394abb9062dfef1a4cf3438abf07c553e7f6911
6
+ metadata.gz: 35dba604ed379b09913369ac0f59b14593c5c6fd40f7fa999733235a71b8ab5da41e9fb6a03e635fc04ab83535eb7699303723c3036cadac9c206208e2873a0c
7
+ data.tar.gz: 5a44d3263e9cafec224645750ae87e7e78faa7d85e27a5dbcc4e6a318658a1bdfec3da2554003fe6de712582a282341b655d2cbb8096385babf82603a2cad123
@@ -30,6 +30,26 @@ module StateOfTheNation
30
30
  (finish.blank? || round_if_should(finish) > round_if_should(time)) && round_if_should(start) <= round_if_should(time)
31
31
  end
32
32
 
33
+ define_method "active_in_interval?" do |interval_start, interval_end|
34
+ record_start = round_if_should(start)
35
+ record_end = round_if_should(finish)
36
+ if ignore_empty && record_start == record_end
37
+ false
38
+ elsif interval_start.nil? && interval_end.nil?
39
+ true
40
+ elsif interval_start == interval_end
41
+ active?(interval_start)
42
+ elsif interval_start.nil?
43
+ record_start < interval_end
44
+ elsif interval_end.nil?
45
+ record_end.nil? || record_end > interval_start
46
+ elsif record_end.nil?
47
+ interval_end > record_start
48
+ else
49
+ record_start < interval_end && record_end > interval_start
50
+ end
51
+ end
52
+
33
53
  scope :active, lambda { |time = Time.now.utc|
34
54
  where(QueryString.query_for(:active_scope, self), round_if_should(time), round_if_should(time))
35
55
  }
@@ -1,3 +1,3 @@
1
1
  module StateOfTheNation
2
- VERSION = "1.1.5"
2
+ VERSION = "1.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: state_of_the_nation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick O'Doherty
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-03-03 00:00:00.000000000 Z
12
+ date: 2020-03-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler