amee-analytics 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.2
|
data/amee-analytics.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{amee-analytics}
|
8
|
-
s.version = "2.1.
|
8
|
+
s.version = "2.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [
|
12
|
-
s.date = %q{2011-
|
11
|
+
s.authors = [%q{James Hetherington}, %q{Andrew Berkeley}, %q{James Smith}, %q{George Palmer}]
|
12
|
+
s.date = %q{2011-11-03}
|
13
13
|
s.description = %q{Part of the AMEE AppKit, this gem provides the ability to do mathmatical operations over a set of calculations}
|
14
14
|
s.email = %q{help@amee.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -39,9 +39,9 @@ Gem::Specification.new do |s|
|
|
39
39
|
"spec/spec_helper.rb"
|
40
40
|
]
|
41
41
|
s.homepage = %q{http://github.com/AMEE/amee-analytics}
|
42
|
-
s.licenses = [
|
43
|
-
s.require_paths = [
|
44
|
-
s.rubygems_version = %q{1.
|
42
|
+
s.licenses = [%q{MIT}]
|
43
|
+
s.require_paths = [%q{lib}]
|
44
|
+
s.rubygems_version = %q{1.8.6}
|
45
45
|
s.summary = %q{Analytics module for use with AMEE AppKit}
|
46
46
|
|
47
47
|
if s.respond_to? :specification_version then
|
@@ -102,12 +102,12 @@ module AMEE
|
|
102
102
|
#
|
103
103
|
def standardize_units(term,unit=nil,per_unit=nil)
|
104
104
|
term = term.to_sym unless term.is_a? Symbol
|
105
|
-
|
105
|
+
send(term).standardize_units(unit,per_unit).map do |term|
|
106
106
|
calc = term.parent
|
107
107
|
calc.contents[term.label] = term
|
108
108
|
calc
|
109
109
|
end
|
110
|
-
AMEE::DataAbstraction::CalculationCollection.new(
|
110
|
+
AMEE::DataAbstraction::CalculationCollection.new(self)
|
111
111
|
end
|
112
112
|
|
113
113
|
# Similar to <tt>#standardize_units</tt> but standardizes units in place,
|
@@ -154,8 +154,8 @@ module AMEE
|
|
154
154
|
# list.standardize_units(nil, 'BTU') #=> <TermsList>
|
155
155
|
#
|
156
156
|
def standardize_units(unit=nil,per_unit=nil)
|
157
|
-
return self if homogeneous?
|
158
|
-
(per_unit.nil?
|
157
|
+
return self if homogeneous? && ((unit.nil? or (first.unit && first.unit.label == unit)) &&
|
158
|
+
(per_unit.nil? || (first.per_unit && first.per_unit.label == per_unit)))
|
159
159
|
unit = predominant_unit if unit.nil?
|
160
160
|
per_unit = predominant_per_unit if per_unit.nil?
|
161
161
|
new_terms = map { |term| term.convert_unit(:unit => unit, :per_unit => per_unit) }
|
@@ -155,6 +155,34 @@ describe CalculationCollection do
|
|
155
155
|
coll.first['co2'].value.should be_within(0.01).of(529109.429243706)
|
156
156
|
end
|
157
157
|
|
158
|
+
it "should standardize units in place and retain calcs missing term" do
|
159
|
+
@coll.first['usage'].unit 'J'
|
160
|
+
@coll.first['usage'].value.should eql 500
|
161
|
+
@coll.first['usage'].unit.label.should eql 'J'
|
162
|
+
pp @coll
|
163
|
+
@coll[1].contents.delete(:usage)
|
164
|
+
pp @coll
|
165
|
+
@coll.size.should eql 3
|
166
|
+
@coll.standardize_units!(:usage,:kWh)
|
167
|
+
pp @coll
|
168
|
+
@coll.first['usage'].unit 'kWh'
|
169
|
+
@coll.first['usage'].value.should be_within(0.000001).of(0.000138888888888889)
|
170
|
+
@coll[1].contents['usage'].should eql nil
|
171
|
+
@coll.size.should eql 3
|
172
|
+
end
|
173
|
+
|
174
|
+
it "should standardize units returning new collection" do
|
175
|
+
@coll.first['co2'].value.should eql 240
|
176
|
+
@coll.first['co2'].unit.label.should eql 't'
|
177
|
+
@coll[1].contents.delete(:co2)
|
178
|
+
@coll.size.should eql 3
|
179
|
+
coll = @coll.standardize_units(:co2,:lb)
|
180
|
+
coll.first['co2'].unit 'lb'
|
181
|
+
coll.first['co2'].value.should be_within(0.01).of(529109.429243706)
|
182
|
+
coll[1].contents['co2'].should eql nil
|
183
|
+
coll.size.should eql 3
|
184
|
+
end
|
185
|
+
|
158
186
|
it "should handle 'type' as a terms filter" do
|
159
187
|
calcs = []
|
160
188
|
calcs << add_transport_calc(500,240)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amee-analytics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 2.1.
|
9
|
+
- 2
|
10
|
+
version: 2.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- James Hetherington
|
@@ -18,12 +18,11 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2011-
|
22
|
-
default_executable:
|
21
|
+
date: 2011-11-03 00:00:00 Z
|
23
22
|
dependencies:
|
24
23
|
- !ruby/object:Gem::Dependency
|
25
|
-
|
26
|
-
|
24
|
+
type: :runtime
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
27
26
|
none: false
|
28
27
|
requirements:
|
29
28
|
- - ~>
|
@@ -33,12 +32,12 @@ dependencies:
|
|
33
32
|
- 2
|
34
33
|
- 2
|
35
34
|
version: "2.2"
|
35
|
+
version_requirements: *id001
|
36
|
+
name: amee-data-abstraction
|
36
37
|
prerelease: false
|
37
|
-
type: :runtime
|
38
|
-
requirement: *id001
|
39
38
|
- !ruby/object:Gem::Dependency
|
40
|
-
|
41
|
-
|
39
|
+
type: :runtime
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
41
|
none: false
|
43
42
|
requirements:
|
44
43
|
- - ~>
|
@@ -48,12 +47,12 @@ dependencies:
|
|
48
47
|
- 2
|
49
48
|
- 2
|
50
49
|
version: "2.2"
|
50
|
+
version_requirements: *id002
|
51
|
+
name: amee-data-persistence
|
51
52
|
prerelease: false
|
52
|
-
type: :runtime
|
53
|
-
requirement: *id002
|
54
53
|
- !ruby/object:Gem::Dependency
|
55
|
-
|
56
|
-
|
54
|
+
type: :development
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
56
|
none: false
|
58
57
|
requirements:
|
59
58
|
- - ~>
|
@@ -64,12 +63,12 @@ dependencies:
|
|
64
63
|
- 0
|
65
64
|
- 0
|
66
65
|
version: 1.0.0
|
66
|
+
version_requirements: *id003
|
67
|
+
name: bundler
|
67
68
|
prerelease: false
|
68
|
-
type: :development
|
69
|
-
requirement: *id003
|
70
69
|
- !ruby/object:Gem::Dependency
|
71
|
-
|
72
|
-
|
70
|
+
type: :development
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
72
|
none: false
|
74
73
|
requirements:
|
75
74
|
- - ~>
|
@@ -80,12 +79,12 @@ dependencies:
|
|
80
79
|
- 6
|
81
80
|
- 4
|
82
81
|
version: 1.6.4
|
82
|
+
version_requirements: *id004
|
83
|
+
name: jeweler
|
83
84
|
prerelease: false
|
84
|
-
type: :development
|
85
|
-
requirement: *id004
|
86
85
|
- !ruby/object:Gem::Dependency
|
87
|
-
|
88
|
-
|
86
|
+
type: :development
|
87
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
89
88
|
none: false
|
90
89
|
requirements:
|
91
90
|
- - ~>
|
@@ -96,12 +95,12 @@ dependencies:
|
|
96
95
|
- 0
|
97
96
|
- 10
|
98
97
|
version: 3.0.10
|
98
|
+
version_requirements: *id005
|
99
|
+
name: rails
|
99
100
|
prerelease: false
|
100
|
-
type: :development
|
101
|
-
requirement: *id005
|
102
101
|
- !ruby/object:Gem::Dependency
|
103
|
-
|
104
|
-
|
102
|
+
type: :development
|
103
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
105
104
|
none: false
|
106
105
|
requirements:
|
107
106
|
- - "="
|
@@ -112,12 +111,12 @@ dependencies:
|
|
112
111
|
- 6
|
113
112
|
- 0
|
114
113
|
version: 2.6.0
|
114
|
+
version_requirements: *id006
|
115
|
+
name: rspec
|
115
116
|
prerelease: false
|
116
|
-
type: :development
|
117
|
-
requirement: *id006
|
118
117
|
- !ruby/object:Gem::Dependency
|
119
|
-
|
120
|
-
|
118
|
+
type: :development
|
119
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
121
120
|
none: false
|
122
121
|
requirements:
|
123
122
|
- - ~>
|
@@ -128,12 +127,12 @@ dependencies:
|
|
128
127
|
- 9
|
129
128
|
- 0
|
130
129
|
version: 0.9.0
|
130
|
+
version_requirements: *id007
|
131
|
+
name: flexmock
|
131
132
|
prerelease: false
|
132
|
-
type: :development
|
133
|
-
requirement: *id007
|
134
133
|
- !ruby/object:Gem::Dependency
|
135
|
-
|
136
|
-
|
134
|
+
type: :development
|
135
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
137
136
|
none: false
|
138
137
|
requirements:
|
139
138
|
- - ">="
|
@@ -142,12 +141,12 @@ dependencies:
|
|
142
141
|
segments:
|
143
142
|
- 0
|
144
143
|
version: "0"
|
144
|
+
version_requirements: *id008
|
145
|
+
name: rcov
|
145
146
|
prerelease: false
|
146
|
-
type: :development
|
147
|
-
requirement: *id008
|
148
147
|
- !ruby/object:Gem::Dependency
|
149
|
-
|
150
|
-
|
148
|
+
type: :development
|
149
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
151
150
|
none: false
|
152
151
|
requirements:
|
153
152
|
- - ">="
|
@@ -156,9 +155,9 @@ dependencies:
|
|
156
155
|
segments:
|
157
156
|
- 0
|
158
157
|
version: "0"
|
158
|
+
version_requirements: *id009
|
159
|
+
name: rdoc
|
159
160
|
prerelease: false
|
160
|
-
type: :development
|
161
|
-
requirement: *id009
|
162
161
|
description: Part of the AMEE AppKit, this gem provides the ability to do mathmatical operations over a set of calculations
|
163
162
|
email: help@amee.com
|
164
163
|
executables: []
|
@@ -189,7 +188,6 @@ files:
|
|
189
188
|
- spec/fixtures/config/calculations/calcs.rb
|
190
189
|
- spec/spec.opts
|
191
190
|
- spec/spec_helper.rb
|
192
|
-
has_rdoc: true
|
193
191
|
homepage: http://github.com/AMEE/amee-analytics
|
194
192
|
licenses:
|
195
193
|
- MIT
|
@@ -219,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
217
|
requirements: []
|
220
218
|
|
221
219
|
rubyforge_project:
|
222
|
-
rubygems_version: 1.
|
220
|
+
rubygems_version: 1.8.6
|
223
221
|
signing_key:
|
224
222
|
specification_version: 3
|
225
223
|
summary: Analytics module for use with AMEE AppKit
|