fossil 0.4.22 → 0.4.23
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.
- data/VERSION +1 -1
- data/fossil.gemspec +1 -1
- data/lib/models/trip_leg.rb +4 -6
- data/spec/models/trip_leg_spec.rb +28 -38
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.23
|
data/fossil.gemspec
CHANGED
data/lib/models/trip_leg.rb
CHANGED
@@ -45,17 +45,15 @@ class TripLeg < Sequel::Model(:'trip legs')
|
|
45
45
|
|
46
46
|
many_to_one :departure_airport, :class=>:Airport, :key=>nil, :dataset=>
|
47
47
|
proc {
|
48
|
-
if !
|
49
|
-
Airport.filter(:'icao'=>
|
50
|
-
elsif !
|
51
|
-
Airport.filter(:'airport id prefix'.like("%#{
|
48
|
+
if !departure_icao.blank?
|
49
|
+
Airport.filter(:'icao'=> departure_icao)
|
50
|
+
elsif !depart_airport_id.blank? and !depart_ap_prefix.blank?
|
51
|
+
Airport.filter(:'airport id prefix'.like("%#{depart_ap_prefix}"), :'airport id'.like("%#{depart_airport_id}"))
|
52
52
|
else
|
53
53
|
Airport.filter(:'icao'=>'FAKE').limit(1)
|
54
54
|
end
|
55
55
|
}
|
56
56
|
|
57
|
-
many_to_one :departure_airport, :class=>:Airport, :key=>:departure_icao, :primary_key=>:icao #:key=>nil, :dataset=>proc{ ref_method = self[:'depart-icao/iata/id']; case ref_method; when 1 then Airport.filter(:'icao'=>self[:'departure icao']); when 2 then Airport.filter(:'iata'=>self[:'departure iata']); else Airport.filter(:'airport id prefix'.like("%#{self[:'depart a/p prefix']}"), :'airport id'.like("%#{self[:'depart airport id']}")); end }
|
58
|
-
|
59
57
|
many_to_one :departure_fuel_vendor, :class=>:Vendor, :key=>:dep_fuel_vendor, :primary_key=>:'vendor id'
|
60
58
|
many_to_one :arrival_fuel_vendor, :class=>:Vendor, :key=>:arr_fuel_vendor, :primary_key=>:'vendor id'
|
61
59
|
|
@@ -7,16 +7,6 @@ describe TripLeg do
|
|
7
7
|
set_fos_db([Airport])
|
8
8
|
end
|
9
9
|
|
10
|
-
it "when there is no arrival_icao" do
|
11
|
-
trip_leg = TripLeg.new(:arrival_icao=>'')
|
12
|
-
trip_leg.arrival_airport.should == nil
|
13
|
-
end
|
14
|
-
|
15
|
-
it "when there is no arrival_ap_prefix or arrival_airport_id" do
|
16
|
-
trip_leg = TripLeg.new(:arrival_icao=>'', :arrival_ap_prefix=>'', :arrival_airport_id=>'')
|
17
|
-
trip_leg.arrival_airport.should == nil
|
18
|
-
end
|
19
|
-
|
20
10
|
it "when there is an arrival_icao" do
|
21
11
|
trip_leg = TripLeg.new(:arrival_icao=>'KSFO')
|
22
12
|
trip_leg.arrival_airport.should_not == nil
|
@@ -26,13 +16,11 @@ describe TripLeg do
|
|
26
16
|
trip_leg = TripLeg.new(:arrival_icao=>'', :arrival_ap_prefix=>'K', :arrival_airport_id=>'SFO')
|
27
17
|
trip_leg.arrival_airport.should_not == nil
|
28
18
|
end
|
29
|
-
end
|
30
19
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
tl.ebt_time.should == Time.from_minutes(20)
|
20
|
+
it "when there is no arrival_ap_prefix or arrival_airport_id" do
|
21
|
+
trip_leg = TripLeg.new(:arrival_icao=>'', :arrival_ap_prefix=>'', :arrival_airport_id=>'')
|
22
|
+
trip_leg.arrival_airport.should == nil
|
23
|
+
end
|
36
24
|
end
|
37
25
|
|
38
26
|
describe "departure_airport assoc works" do
|
@@ -40,25 +28,27 @@ describe TripLeg do
|
|
40
28
|
set_fos_db([Airport])
|
41
29
|
end
|
42
30
|
|
43
|
-
it "when there is
|
44
|
-
trip_leg = TripLeg.new(:
|
45
|
-
trip_leg.
|
31
|
+
it "when there is an departure_icao" do
|
32
|
+
trip_leg = TripLeg.new(:departure_icao=>'KSFO')
|
33
|
+
trip_leg.departure_airport.should_not == nil
|
46
34
|
end
|
47
35
|
|
48
|
-
it "when there is no
|
49
|
-
trip_leg = TripLeg.new(:
|
50
|
-
trip_leg.
|
36
|
+
it "when there is no departure_icao but there is depart_ap_prefix and depart_airport_id" do
|
37
|
+
trip_leg = TripLeg.new(:departure_icao=>'', :depart_ap_prefix=>'K', :depart_airport_id=>'SFO')
|
38
|
+
trip_leg.departure_airport.should_not == nil
|
51
39
|
end
|
52
40
|
|
53
|
-
it "when there is
|
54
|
-
trip_leg = TripLeg.new(:
|
55
|
-
trip_leg.
|
41
|
+
it "when there is no departure_icao or arrival_ap_prefix or arrival_airport_id" do
|
42
|
+
trip_leg = TripLeg.new(:departure_icao=>'', :depart_ap_prefix=>'', :depart_airport_id=>'')
|
43
|
+
trip_leg.departure_airport.should == nil
|
56
44
|
end
|
45
|
+
end
|
57
46
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
47
|
+
it "ebt_time method produces correct Time with minutes" do
|
48
|
+
dept_date_act_gmt = Date.new(2000, 1, 1)
|
49
|
+
tl = TripLeg.new(:arrival_date_gmt=>dept_date_act_gmt.to_fos_days, :eta_gmt=>40,
|
50
|
+
:dept_date_gmt=>dept_date_act_gmt.to_fos_days, :etd_gmt=>20)
|
51
|
+
tl.ebt_time.should == Time.from_minutes(20)
|
62
52
|
end
|
63
53
|
|
64
54
|
it "ebt_time method produces correct Time with minutes" do
|
@@ -122,14 +112,14 @@ describe TripLeg do
|
|
122
112
|
|
123
113
|
describe "should find correct passenger list" do
|
124
114
|
before :each do
|
125
|
-
@p1 = TripPassenger.new(:name=>"dan",
|
126
|
-
@p2 = TripPassenger.new(:name=>"rob",
|
127
|
-
@p3 = TripPassenger.new(:name=>"eric", :departure_leg_number=>1, :arrival_leg_number=>2,
|
115
|
+
@p1 = TripPassenger.new(:name=>"dan", :departure_leg_number=>0, :arrival_leg_number=>0, :lead_pax=>0)
|
116
|
+
@p2 = TripPassenger.new(:name=>"rob", :departure_leg_number=>1, :arrival_leg_number=>1, :lead_pax=>0)
|
117
|
+
@p3 = TripPassenger.new(:name=>"eric", :departure_leg_number=>1, :arrival_leg_number=>2, :lead_pax=>1)
|
128
118
|
@t = Trip.new(:trip_number=>100)
|
129
119
|
end
|
130
120
|
|
131
121
|
it "when leg has no passengers" do
|
132
|
-
mock(@t).passengers {[]}
|
122
|
+
mock(@t).passengers { [] }
|
133
123
|
tl = TripLeg.new(:trip_number=>100, :leg_number=>1, :trip=>@t)
|
134
124
|
tl.passenger_list.should == ''
|
135
125
|
end
|
@@ -140,19 +130,19 @@ describe TripLeg do
|
|
140
130
|
## end
|
141
131
|
|
142
132
|
it "when leg has some in range ( and put lead pax name first )" do
|
143
|
-
stub(@t).passengers {[@p1, @p2, @p3]}
|
133
|
+
stub(@t).passengers { [@p1, @p2, @p3] }
|
144
134
|
tl = TripLeg.new(:trip_number=>100, :leg_number=>1, :verify_date=>0, :trip=>@t)
|
145
135
|
tl.passenger_list.should == "eric (lead pax) : rob"
|
146
136
|
end
|
147
137
|
|
148
138
|
it "when leg has 1 in range" do
|
149
|
-
stub(@t).passengers {[@p1, @p2, @p3]}
|
139
|
+
stub(@t).passengers { [@p1, @p2, @p3] }
|
150
140
|
tl = TripLeg.new(:trip_number=>100, :leg_number=>2, :verify_date=>0, :trip=>@t)
|
151
141
|
tl.passenger_list.should == "eric (lead pax)"
|
152
142
|
end
|
153
143
|
|
154
144
|
it "when leg has none in range" do
|
155
|
-
stub(@t).passengers {[@p1, @p2, @p3]}
|
145
|
+
stub(@t).passengers { [@p1, @p2, @p3] }
|
156
146
|
tl = TripLeg.new(:trip_number=>100, :leg_number=>3, :verify_date=>0, :trip=>@t)
|
157
147
|
tl.passenger_list.should == ""
|
158
148
|
end
|
@@ -167,8 +157,8 @@ describe TripLeg do
|
|
167
157
|
|
168
158
|
describe 'crew brief fields' do
|
169
159
|
before :all do
|
170
|
-
set_fos_db([TripLeg,Comment])
|
171
|
-
@trip_leg = TripLeg.first(:trip_number=>50885
|
160
|
+
set_fos_db([TripLeg, Comment])
|
161
|
+
@trip_leg = TripLeg.first(:trip_number=>50885, :leg_number=>1)
|
172
162
|
# @trip_leg = TripLeg.first(:trip_number=>76478,:leg_number=>1)
|
173
163
|
# @trip_leg = TripLeg.first(~:fueler_comment=>0,~:catering_comment=>0,~:limo_comment=>0)
|
174
164
|
end
|