cqm-reports 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8ef5e1f1c6d14646a8d523109b41d9d9609503c
4
- data.tar.gz: 1ccc64f200b387965a3271501cb933e795435cba
3
+ metadata.gz: 6af15ff075a9533c61c844f95c5adc741e999dec
4
+ data.tar.gz: 2cf3f0aeb6c3e1744e5e2f8a45a8d0e90a1ab5a1
5
5
  SHA512:
6
- metadata.gz: 62af1b280c4701bed265910f768bb6d19be6f087bd028b022b9cdfbd4b02fae834252fc1ed0798e6555b4e978962f9e4d237d27c9528523cc5c6ba89d8ace2e1
7
- data.tar.gz: 71cc7d395c9af17f8d946e28ac108f25142c9d2e4e6028e4799e8297fb8a5fc47f1b898939554cbd7616494320ec9d79c8caa489fc8bda0b60f3eb4050f8d69f
6
+ metadata.gz: a4ab0c6c763b00dfa1c7985110969e6262ecc977d9a6509ca64c82e3979e6fd6e27f1bd888ae05ac5eaeecf600645a7cfea95d7013f8a5b01d1b85e865d80f52
7
+ data.tar.gz: fdfe64bbfb95f37e11dae78380147076daeb9b155a05eadb663c063191ffb9155390af0ae32a6f9643d87d852d605a87cb6fd48c4dc1cf0c9f631a7f929c4538
@@ -92,7 +92,9 @@ module QRDA
92
92
  end
93
93
 
94
94
  def extract_interval(parent_element, interval_xpath)
95
- return nil unless parent_element.at_xpath(interval_xpath)
95
+ # nil if the time interval does not exist
96
+ return nil unless time_interval_exists(parent_element, interval_xpath)
97
+
96
98
  if parent_element.at_xpath("#{interval_xpath}/@value")
97
99
  low_time = DateTime.parse(parent_element.at_xpath(interval_xpath)['value'])
98
100
  high_time = DateTime.parse(parent_element.at_xpath(interval_xpath)['value'])
@@ -129,6 +131,14 @@ module QRDA
129
131
  QDM::Interval.new(low_time, high_time).shift_dates(0)
130
132
  end
131
133
 
134
+ def time_interval_exists(parent_element, interval_xpath)
135
+ # false if the time interval does not exist
136
+ return false unless parent_element.at_xpath(interval_xpath)
137
+ # false if the time element exists but has a null Flavor
138
+ return false if parent_element.at_xpath(interval_xpath)['nullFlavor']
139
+ true
140
+ end
141
+
132
142
  def extract_time(parent_element, datetime_xpath)
133
143
  DateTime.parse(parent_element.at_xpath(datetime_xpath)['value']) if parent_element.at_xpath("#{datetime_xpath}/@value")
134
144
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cqm-reports
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - The MITRE Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-02 00:00:00.000000000 Z
11
+ date: 2020-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cqm-models