flight 0.0.21 → 0.0.22
Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@ Feature: Flight Committee Calculations
|
|
5
5
|
Given a flight emitter
|
6
6
|
And a characteristic "origin_airport.iata_code" of "AIA"
|
7
7
|
When the "cohort" committee is calculated
|
8
|
-
Then the conclusion of the committee should have a record with "count" equal to "
|
8
|
+
Then the conclusion of the committee should have a record with "count" equal to "2"
|
9
9
|
|
10
10
|
Scenario: Cohort committee from t100 with no usable characteristics
|
11
11
|
Given a flight emitter
|
@@ -76,7 +76,7 @@ Feature: Flight Committee Calculations
|
|
76
76
|
Given a flight emitter
|
77
77
|
When the "freight_share" committee is calculated
|
78
78
|
Then the committee should have used quorum "default"
|
79
|
-
And the conclusion of the committee should be "0.
|
79
|
+
And the conclusion of the committee should be "0.07065"
|
80
80
|
|
81
81
|
Scenario: Fuel type committee from default
|
82
82
|
Given a flight emitter
|
@@ -177,7 +177,7 @@ Feature: Flight Committee Calculations
|
|
177
177
|
Given a flight emitter
|
178
178
|
When the "load_factor" committee is calculated
|
179
179
|
Then the committee should have used quorum "default"
|
180
|
-
And the conclusion of the committee should be "0.
|
180
|
+
And the conclusion of the committee should be "0.85"
|
181
181
|
|
182
182
|
Scenario Outline: Seats committee from aircraft
|
183
183
|
Given a flight emitter
|
@@ -220,7 +220,7 @@ Feature: Flight Committee Calculations
|
|
220
220
|
Given a flight emitter
|
221
221
|
When the "seats" committee is calculated
|
222
222
|
Then the committee should have used quorum "default"
|
223
|
-
And the conclusion of the committee should be "
|
223
|
+
And the conclusion of the committee should be "118"
|
224
224
|
|
225
225
|
Scenario: Passengers committee
|
226
226
|
Given a flight emitter
|
@@ -268,7 +268,7 @@ Feature: Flight Committee Calculations
|
|
268
268
|
And the conclusion of the committee should have a record with "endpoint_fuel" equal to "<b>"
|
269
269
|
Examples:
|
270
270
|
| origin | m3 | m2 | m1 | b |
|
271
|
-
| AIA | 0 | 0 |
|
271
|
+
| AIA | 0 | 0 | 1 | 0 |
|
272
272
|
|
273
273
|
Scenario Outline: Fuel use coefficients committee from default
|
274
274
|
Given a flight emitter
|
@@ -11,4 +11,4 @@ Feature: Flight Emissions Calculations
|
|
11
11
|
Then the emission value should be within "0.1" kgs of "<emission>"
|
12
12
|
Examples:
|
13
13
|
| source | dest | airline | date | aircraft | emission |
|
14
|
-
| DCA | JFK | AA | 2010-06-25 | 1 |
|
14
|
+
| DCA | JFK | AA | 2010-06-25 | 1 | 148.4 |
|
data/lib/flight/carbon_model.rb
CHANGED
@@ -69,7 +69,8 @@ module BrighterPlanet
|
|
69
69
|
flight_segment_aircraft = flight_segments.inject({}) do |hsh, flight_segment|
|
70
70
|
bts_code = flight_segment.bts_aircraft_type_code
|
71
71
|
key = flight_segment.row_hash
|
72
|
-
|
72
|
+
aircraft = Aircraft.find_by_bts_aircraft_type_code bts_code
|
73
|
+
hsh[key] = aircraft if aircraft
|
73
74
|
hsh
|
74
75
|
end
|
75
76
|
|
@@ -103,9 +104,14 @@ module BrighterPlanet
|
|
103
104
|
m1 = Aircraft.fallback.m1
|
104
105
|
end
|
105
106
|
|
106
|
-
|
107
|
-
|
108
|
-
|
107
|
+
if flight_segment_aircraft.values.map(&:endpoint_fuel).any?
|
108
|
+
endpoint_fuel = flight_segments.inject(0) do |endpoint_fuel, flight_segment|
|
109
|
+
aircraft = flight_segment_aircraft[flight_segment.row_hash]
|
110
|
+
aircraft_epfuel = aircraft.andand.endpoint_fuel || 0
|
111
|
+
endpoint_fuel + (aircraft_epfuel * flight_segment.passengers)
|
112
|
+
end
|
113
|
+
else
|
114
|
+
endpoint_fuel = Aircraft.fallback.endpoint_fuel
|
109
115
|
end
|
110
116
|
|
111
117
|
if [m3, m2, m1, endpoint_fuel, passengers].any?(&:nonzero?)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 51
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 22
|
10
|
+
version: 0.0.22
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andy Rossmeissl
|