fossil 0.5.9 → 0.5.10

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.9
1
+ 0.5.10
data/fossil.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fossil}
8
- s.version = "0.5.9"
8
+ s.version = "0.5.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Patrick Lardin, Daniel Sudol"]
12
- s.date = %q{2010-10-27}
12
+ s.date = %q{2010-10-29}
13
13
  s.description = %q{Access FOS/betrieve db with this Sequel based orm wrapper}
14
14
  s.email = %q{plardin@xojet.com}
15
15
  s.extra_rdoc_files = [
@@ -178,6 +178,7 @@ Gem::Specification.new do |s|
178
178
  "spec/sequel/serializer/json_serializer_spec.rb",
179
179
  "spec/sequel/serializer/xml_serializer_spec.rb",
180
180
  "spec/sequel/pervasive_adapter_spec.rb",
181
+ "spec/silly_spec.rb",
181
182
  "spec/helper_classes.rb",
182
183
  "spec/models/code_spec.rb",
183
184
  "spec/models/trip_leg_spec.rb",
@@ -69,8 +69,9 @@ class TripLeg < Sequel::Model(:'trip legs')
69
69
  many_to_one :departure_general_comment, :class=>:Comment, :key=>nil, :dataset=>proc { Comment.filter( :"kid - date"=>self[:"kid - date"], :"kid - time"=>self[:"kid - time"], :"kid - user"=>self[:"kid - user"], :"kid - mult"=>self[:"kid - mult"], :"kid - comm"=>183) }
70
70
  many_to_one :arrival_general_comment, :class=>:Comment, :key=>nil, :dataset=>proc { Comment.filter( :"kid - date"=>self[:"kid - date"], :"kid - time"=>self[:"kid - time"], :"kid - user"=>self[:"kid - user"], :"kid - mult"=>self[:"kid - mult"], :"kid - comm"=>185) }
71
71
 
72
- many_to_one :limo_comment_value, :class=>:Comment, :key=>nil, :dataset=>proc { Comment.filter( :"kid - date"=>self[:"kid - date"], :"kid - time"=>self[:"kid - time"], :"kid - user"=>self[:"kid - user"], :"kid - mult"=>self[:"kid - mult"], :"kid - comm"=>self[:"limo comment"]) }
73
- many_to_one :crew_fbo_comment_value, :class=>:Comment, :key=>nil, :dataset=>proc { Comment.filter( :"kid - date"=>self[:"kid - date"], :"kid - time"=>self[:"kid - time"], :"kid - user"=>self[:"kid - user"], :"kid - mult"=>self[:"kid - mult"], :"kid - comm"=>self[:"mics serv 2 comment"]) }
72
+ many_to_one :limo_comment, :class=>:Comment, :key=>nil, :dataset=>proc { Comment.filter( :"kid - date"=>self[:"kid - date"], :"kid - time"=>self[:"kid - time"], :"kid - user"=>self[:"kid - user"], :"kid - mult"=>self[:"kid - mult"], :"kid - comm"=>self[:"limo comment"]) }
73
+ many_to_one :crew_transport_comment, :class=>:Comment, :key=>nil, :dataset=>proc { Comment.filter( :"kid - date"=>self[:"kid - date"], :"kid - time"=>self[:"kid - time"], :"kid - user"=>self[:"kid - user"], :"kid - mult"=>self[:"kid - mult"], :"kid - comm"=>self[:"crewlimo comment"]) }
74
+ many_to_one :crew_fbo_comment, :class=>:Comment, :key=>nil, :dataset=>proc { Comment.filter( :"kid - date"=>self[:"kid - date"], :"kid - time"=>self[:"kid - time"], :"kid - user"=>self[:"kid - user"], :"kid - mult"=>self[:"kid - mult"], :"kid - comm"=>self[:"mics serv 2 comment"]) }
74
75
 
75
76
  # One to many associations with composite primary keys
76
77
  o_to_n :crew_legs, :class=>:CrewLeg, :prefix=>'trip leg'
@@ -800,9 +801,14 @@ class TripLeg < Sequel::Model(:'trip legs')
800
801
  case status
801
802
  when 0 then "SCHED"
802
803
  when 1 then "VERI"
803
- when 10 then "CANC"
804
- when 23 then "CANC"
805
- when 21 then "MAINT"
804
+ when 10,23 then "CANC"
805
+ when 21 then
806
+ case leg_type_code
807
+ when 7 then "UMAINT"
808
+ when 103 then "SMAINT"
809
+ # when 113 then "RMAINT"
810
+ else "MAINT"
811
+ end
806
812
  when 20 then "SCHED" #really is "RESVD"
807
813
  else "[#{status}]";
808
814
  end
@@ -2,202 +2,195 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
3
  describe TripLeg do
4
4
 
5
- it "catering association works with eager graph" do
6
- set_fos_db([TripLeg,Comment])
7
- p TripLeg.db
8
- t = TripLeg.filter(:'trip legs__kid_date'=>66254).eager_graph(:aircraft).limit(1).all.first
9
- t.departure_general_comment
5
+ describe "leg_status" do
6
+ it "shows scheduled maint status" do
7
+ t = TripLeg.filter(:trip_number=>68070,:leg_number=> 5).first
8
+ t.leg_status.should == "SMAINT"
9
+ end
10
10
  end
11
11
 
12
- # describe "arrival_airport assoc works" do
13
- # before :all do
14
- # set_fos_db([Airport])
15
- # end
16
- #
17
- # it "when there is an arrival_icao" do
18
- # trip_leg = TripLeg.new(:arrival_icao=>'KSFO')
19
- # trip_leg.arrival_airport.should_not == nil
20
- # end
21
- #
22
- # it "when there is no arrival_icao but there is arrival_ap_prefix and arrival_airport_id" do
23
- # trip_leg = TripLeg.new(:arrival_icao=>'', :arrival_ap_prefix=>'K', :arrival_airport_id=>'SFO')
24
- # trip_leg.arrival_airport.should_not == nil
25
- # end
26
- #
27
- # it "when there is no arrival_ap_prefix or arrival_airport_id" do
28
- # trip_leg = TripLeg.new(:arrival_icao=>'', :arrival_ap_prefix=>'', :arrival_airport_id=>'')
29
- # trip_leg.arrival_airport.should == nil
30
- # end
31
- # end
32
- #
33
- # describe "departure_airport assoc works" do
34
- # before :all do
35
- # set_fos_db([Airport])
36
- # end
37
- #
38
- # it "when there is an departure_icao" do
39
- # trip_leg = TripLeg.new(:departure_icao=>'KSFO')
40
- # trip_leg.departure_airport.should_not == nil
41
- # end
42
- #
43
- # it "when there is no departure_icao but there is depart_ap_prefix and depart_airport_id" do
44
- # trip_leg = TripLeg.new(:departure_icao=>'', :depart_ap_prefix=>'K', :depart_airport_id=>'SFO')
45
- # trip_leg.departure_airport.should_not == nil
46
- # end
47
- #
48
- # it "when there is no departure_icao or arrival_ap_prefix or arrival_airport_id" do
49
- # trip_leg = TripLeg.new(:departure_icao=>'', :depart_ap_prefix=>'', :depart_airport_id=>'')
50
- # trip_leg.departure_airport.should == nil
51
- # end
52
- # end
53
- #
54
- # it "ebt_time method produces correct Time with minutes" do
55
- # dept_date_act_gmt = Date.new(2000, 1, 1)
56
- # tl = TripLeg.new(:arrival_date_gmt=>dept_date_act_gmt.to_fos_days, :eta_gmt=>40,
57
- # :dept_date_gmt=>dept_date_act_gmt.to_fos_days, :etd_gmt=>20)
58
- # tl.ebt_time.should == Time.from_minutes(20)
59
- # end
60
- #
61
- # it "ebt_time method produces correct Time with minutes" do
62
- # dept_date_act_gmt = Date.new(2000, 1, 1)
63
- # tl = TripLeg.new(:arrival_date_gmt=>dept_date_act_gmt.to_fos_days, :eta_gmt=>40,
64
- # :dept_date_gmt=>dept_date_act_gmt.to_fos_days, :etd_gmt=>20)
65
- # tl.ebt_time.should == Time.from_minutes(20)
66
- # end
67
- #
68
- # it "actual take off date_time dates are after dept_date_act_gmt if take off time is less than depart time" do
69
- # dept_date_act_gmt = Date.new(1900, 1, 1)
70
- # tl = TripLeg.new(:dept_date_act_gmt=>dept_date_act_gmt.to_fos_days, :t_o_time_act_gmt=>20, :dept_time_act_gmt=>1420)
71
- # tl.actual_takeoff_date_time_gmt.should == DateTime.new(1900, 1, 2, 0, 20, 0)
72
- # end
73
- #
74
- # it "actual take off date_time dates are the same as dept_date_act_gmt if take off time is not less than depart time" do
75
- # dept_date_act_gmt = Date.new(1900, 1, 1)
76
- # tl = TripLeg.new(:dept_date_act_gmt=>dept_date_act_gmt.to_fos_days, :t_o_time_act_gmt=>40, :dept_time_act_gmt=>20)
77
- # tl.actual_takeoff_date_time_gmt.should == DateTime.new(1900, 1, 1, 0, 40, 0)
78
- # end
79
- #
80
- # it "actual landing date_time dates are before arr_date_act_gmt if on time time is greater than landing time" do
81
- # arr_date_act_gmt = Date.new(1900, 1, 2)
82
- # tl = TripLeg.new(:arrival_date_gmt=>arr_date_act_gmt.to_fos_days, :land_time_act_gmt=>1420, :arriv_time_act_gmt=>20)
83
- # tl.actual_land_date_time_gmt.should == DateTime.new(1900, 1, 1, 23, 40, 0)
84
- # end
85
- #
86
- # it "actual landing date_time dates are the same as arr_date_act_gmt if on time time is not greater than landing time" do
87
- # arr_date_act_gmt = Date.new(1900, 1, 2)
88
- # tl = TripLeg.new(:arrival_date_gmt=>arr_date_act_gmt.to_fos_days, :land_time_act_gmt=>20, :arriv_time_act_gmt=>40)
89
- # tl.actual_land_date_time_gmt.should == DateTime.new(1900, 1, 2, 0, 20, 0)
90
- # end
91
- #
92
- # it "actual arrival date_time base are correctly calculating the tz offset" do
93
- # arr_date_act_gmt = Date.new(1900, 1, 2)
94
- # arriv_time_act_gmt = 1420
95
- # home_tz_gmt_offset = -70
96
- # tl = TripLeg.new(:arrival_date_gmt => arr_date_act_gmt.to_fos_days, :arriv_time_act_gmt => arriv_time_act_gmt,
97
- # :home_tz_gmt_offset => home_tz_gmt_offset)
98
- # tl.actual_arrival_date_time_base.should == DateTime.new(1900, 1, 2, 16, 40, 0)
99
- # end
100
- #
101
- # it "actual departure date_time base are correctly calculating the tz offset" do
102
- # dept_date_act_gmt = Date.new(1900, 1, 2)
103
- # dept_time_act_gmt = 1420
104
- # home_tz_gmt_offset = -70
105
- # tl = TripLeg.new(:dept_date_act_gmt => dept_date_act_gmt.to_fos_days, :dept_time_act_gmt => dept_time_act_gmt,
106
- # :home_tz_gmt_offset=>home_tz_gmt_offset)
107
- # tl.actual_departure_date_time_base.should == DateTime.new(1900, 1, 2, 16, 40, 0)
108
- # end
109
- #
110
- # it "should properly convert nautical miles to statute miles with 1 significant digit" do
111
- # tl = TripLeg.new(:nautical_miles => 285)
112
- # tl.custom_statute_miles.should == 327.9
113
- # end
114
- #
115
- # it "should properly handle nautical miles to statute miles when nautical_miles is nil" do
116
- # tl = TripLeg.new(:nautical_miles => nil)
117
- # tl.custom_statute_miles.should == 0
118
- # end
119
- #
120
- # describe "should find correct passenger list" do
121
- # before :each do
122
- # @p1 = TripPassenger.new(:name=>"dan", :departure_leg_number=>0, :arrival_leg_number=>0, :lead_pax=>0)
123
- # @p2 = TripPassenger.new(:name=>"rob", :departure_leg_number=>1, :arrival_leg_number=>1, :lead_pax=>0)
124
- # @p3 = TripPassenger.new(:name=>"eric", :departure_leg_number=>1, :arrival_leg_number=>2, :lead_pax=>1)
125
- # @t = Trip.new(:trip_number=>100)
126
- # end
127
- #
128
- # it "when leg has no passengers" do
129
- # mock(@t).passengers { [] }
130
- # tl = TripLeg.new(:trip_number=>100, :leg_number=>1, :trip=>@t)
131
- # tl.passenger_list.should == ''
132
- # end
133
- ##
134
- #### it "when leg has no pax/deadhead" do
135
- #### tl = TripLeg.new(:trip_number=>100,:leg_number=>1, :trip=>@t, :status=>1,:deadhead=>1)
136
- #### tl.passenger_list.should == ''
137
- #### end
138
- #
139
- # it "when leg has some in range ( and put lead pax name first )" do
140
- # stub(@t).passengers { [@p1, @p2, @p3] }
141
- # tl = TripLeg.new(:trip_number=>100, :leg_number=>1, :verify_date=>0, :trip=>@t)
142
- # tl.passenger_list.should == "eric (lead pax) : rob"
143
- # end
144
- #
145
- # it "when leg has 1 in range" do
146
- # stub(@t).passengers { [@p1, @p2, @p3] }
147
- # tl = TripLeg.new(:trip_number=>100, :leg_number=>2, :verify_date=>0, :trip=>@t)
148
- # tl.passenger_list.should == "eric (lead pax)"
149
- # end
150
- #
151
- # it "when leg has none in range" do
152
- # stub(@t).passengers { [@p1, @p2, @p3] }
153
- # tl = TripLeg.new(:trip_number=>100, :leg_number=>3, :verify_date=>0, :trip=>@t)
154
- # tl.passenger_list.should == ""
155
- # end
156
- #
157
- # end
158
- #
159
- # it "method total_trip_statute_miles returns a value" do
160
- # @t = Trip.new(:total_statute_miles=>100)
161
- # tl = TripLeg.new(:trip_number=>100, :leg_number=>3, :trip=>@t)
162
- # tl.total_trip_statute_miles.should == 10.0
163
- # end
12
+ describe "arrival_airport assoc works" do
13
+ before :all do
14
+ set_fos_db([Airport])
15
+ end
164
16
 
17
+ it "when there is an arrival_icao" do
18
+ trip_leg = TripLeg.new(:arrival_icao=>'KSFO')
19
+ trip_leg.arrival_airport.should_not == nil
20
+ end
165
21
 
22
+ it "when there is no arrival_icao but there is arrival_ap_prefix and arrival_airport_id" do
23
+ trip_leg = TripLeg.new(:arrival_icao=>'', :arrival_ap_prefix=>'K', :arrival_airport_id=>'SFO')
24
+ trip_leg.arrival_airport.should_not == nil
25
+ end
166
26
 
27
+ it "when there is no arrival_ap_prefix or arrival_airport_id" do
28
+ trip_leg = TripLeg.new(:arrival_icao=>'', :arrival_ap_prefix=>'', :arrival_airport_id=>'')
29
+ trip_leg.arrival_airport.should == nil
30
+ end
31
+ end
167
32
 
33
+ describe "departure_airport assoc works" do
34
+ before :all do
35
+ set_fos_db([Airport])
36
+ end
168
37
 
169
- # describe 'crew brief fields' do
170
- # before :all do
171
- # set_fos_db([TripLeg, Comment])
172
- # @trip_leg = TripLeg.first(:trip_number=>50885, :leg_number=>1)
173
- ## @trip_leg = TripLeg.first(:trip_number=>76478,:leg_number=>1)
174
- ## @trip_leg = TripLeg.first(~:fueler_comment=>0,~:catering_comment=>0,~:limo_comment=>0)
175
- # end
176
- #
177
- # it "catering departure value" do
178
- # @trip_leg.catering_departure.should == 1
179
- # end
180
- #
181
- # it "departure fbo comment value" do
182
- # @trip_leg.departure_fbo_comment_value.comment.should == "3028 Peacekeeper Way\r\nSacramento, CA 95652"
183
- # end
184
- #
185
- # it "arrival fbo comment value" do
186
- # @trip_leg.arrival_fbo_comment_value.comment.should == "Auto-selected FBO not preferred"
187
- # end
188
- #
189
- # it "catering comment value" do
190
- # @trip_leg.departure_catering_comment__comment.should == "Catering: Standard drinks and snacks for all live legs"
191
- # end
192
- #
193
- # it "limo comment value" do
194
- # @trip_leg.arrival_transport_comment__comment.should == "Transportation: Passenger arranged for all live legs"
195
- # end
196
- #
197
- # it "crew fbo comment value" do
198
- # @trip_leg.crew_fbo_comment_value.should == nil
199
- # end
200
- # end
38
+ it "when there is an departure_icao" do
39
+ trip_leg = TripLeg.new(:departure_icao=>'KSFO')
40
+ trip_leg.departure_airport.should_not == nil
41
+ end
42
+
43
+ it "when there is no departure_icao but there is depart_ap_prefix and depart_airport_id" do
44
+ trip_leg = TripLeg.new(:departure_icao=>'', :depart_ap_prefix=>'K', :depart_airport_id=>'SFO')
45
+ trip_leg.departure_airport.should_not == nil
46
+ end
47
+
48
+ it "when there is no departure_icao or arrival_ap_prefix or arrival_airport_id" do
49
+ trip_leg = TripLeg.new(:departure_icao=>'', :depart_ap_prefix=>'', :depart_airport_id=>'')
50
+ trip_leg.departure_airport.should == nil
51
+ end
52
+ end
53
+
54
+ it "ebt_time method produces correct Time with minutes" do
55
+ dept_date_act_gmt = Date.new(2000, 1, 1)
56
+ tl = TripLeg.new(:arrival_date_gmt=>dept_date_act_gmt.to_fos_days, :eta_gmt=>40,
57
+ :dept_date_gmt=>dept_date_act_gmt.to_fos_days, :etd_gmt=>20)
58
+ tl.ebt_time.should == Time.from_minutes(20)
59
+ end
60
+
61
+ it "ebt_time method produces correct Time with minutes" do
62
+ dept_date_act_gmt = Date.new(2000, 1, 1)
63
+ tl = TripLeg.new(:arrival_date_gmt=>dept_date_act_gmt.to_fos_days, :eta_gmt=>40,
64
+ :dept_date_gmt=>dept_date_act_gmt.to_fos_days, :etd_gmt=>20)
65
+ tl.ebt_time.should == Time.from_minutes(20)
66
+ end
67
+
68
+ it "actual take off date_time dates are after dept_date_act_gmt if take off time is less than depart time" do
69
+ dept_date_act_gmt = Date.new(1900, 1, 1)
70
+ tl = TripLeg.new(:dept_date_act_gmt=>dept_date_act_gmt.to_fos_days, :t_o_time_act_gmt=>20, :dept_time_act_gmt=>1420)
71
+ tl.actual_takeoff_date_time_gmt.should == DateTime.new(1900, 1, 2, 0, 20, 0)
72
+ end
73
+
74
+ it "actual take off date_time dates are the same as dept_date_act_gmt if take off time is not less than depart time" do
75
+ dept_date_act_gmt = Date.new(1900, 1, 1)
76
+ tl = TripLeg.new(:dept_date_act_gmt=>dept_date_act_gmt.to_fos_days, :t_o_time_act_gmt=>40, :dept_time_act_gmt=>20)
77
+ tl.actual_takeoff_date_time_gmt.should == DateTime.new(1900, 1, 1, 0, 40, 0)
78
+ end
79
+
80
+ it "actual landing date_time dates are before arr_date_act_gmt if on time time is greater than landing time" do
81
+ arr_date_act_gmt = Date.new(1900, 1, 2)
82
+ tl = TripLeg.new(:arrival_date_gmt=>arr_date_act_gmt.to_fos_days, :land_time_act_gmt=>1420, :arriv_time_act_gmt=>20)
83
+ tl.actual_land_date_time_gmt.should == DateTime.new(1900, 1, 1, 23, 40, 0)
84
+ end
85
+
86
+ it "actual landing date_time dates are the same as arr_date_act_gmt if on time time is not greater than landing time" do
87
+ arr_date_act_gmt = Date.new(1900, 1, 2)
88
+ tl = TripLeg.new(:arrival_date_gmt=>arr_date_act_gmt.to_fos_days, :land_time_act_gmt=>20, :arriv_time_act_gmt=>40)
89
+ tl.actual_land_date_time_gmt.should == DateTime.new(1900, 1, 2, 0, 20, 0)
90
+ end
91
+
92
+ it "actual arrival date_time base are correctly calculating the tz offset" do
93
+ arr_date_act_gmt = Date.new(1900, 1, 2)
94
+ arriv_time_act_gmt = 1420
95
+ home_tz_gmt_offset = -70
96
+ tl = TripLeg.new(:arrival_date_gmt => arr_date_act_gmt.to_fos_days, :arriv_time_act_gmt => arriv_time_act_gmt,
97
+ :home_tz_gmt_offset => home_tz_gmt_offset)
98
+ tl.actual_arrival_date_time_base.should == DateTime.new(1900, 1, 2, 16, 40, 0)
99
+ end
100
+
101
+ it "actual departure date_time base are correctly calculating the tz offset" do
102
+ dept_date_act_gmt = Date.new(1900, 1, 2)
103
+ dept_time_act_gmt = 1420
104
+ home_tz_gmt_offset = -70
105
+ tl = TripLeg.new(:dept_date_act_gmt => dept_date_act_gmt.to_fos_days, :dept_time_act_gmt => dept_time_act_gmt,
106
+ :home_tz_gmt_offset=>home_tz_gmt_offset)
107
+ tl.actual_departure_date_time_base.should == DateTime.new(1900, 1, 2, 16, 40, 0)
108
+ end
109
+
110
+ it "should properly convert nautical miles to statute miles with 1 significant digit" do
111
+ tl = TripLeg.new(:nautical_miles => 285)
112
+ tl.custom_statute_miles.should == 327.9
113
+ end
114
+
115
+ it "should properly handle nautical miles to statute miles when nautical_miles is nil" do
116
+ tl = TripLeg.new(:nautical_miles => nil)
117
+ tl.custom_statute_miles.should == 0
118
+ end
119
+
120
+ describe "should find correct passenger list" do
121
+ before :each do
122
+ @p1 = TripPassenger.new(:name=>"dan", :departure_leg_number=>0, :arrival_leg_number=>0, :lead_pax=>0)
123
+ @p2 = TripPassenger.new(:name=>"rob", :departure_leg_number=>1, :arrival_leg_number=>1, :lead_pax=>0)
124
+ @p3 = TripPassenger.new(:name=>"eric", :departure_leg_number=>1, :arrival_leg_number=>2, :lead_pax=>1)
125
+ @t = Trip.new(:trip_number=>100)
126
+ end
127
+
128
+ it "when leg has no passengers" do
129
+ mock(@t).passengers { [] }
130
+ tl = TripLeg.new(:trip_number=>100, :leg_number=>1, :trip=>@t)
131
+ tl.passenger_list.should == ''
132
+ end
133
+
134
+ it "when leg has some in range ( and put lead pax name first )" do
135
+ stub(@t).passengers { [@p1, @p2, @p3] }
136
+ tl = TripLeg.new(:trip_number=>100, :leg_number=>1, :verify_date=>0, :trip=>@t)
137
+ tl.passenger_list.should == "eric (lead pax) : rob"
138
+ end
139
+
140
+ it "when leg has 1 in range" do
141
+ stub(@t).passengers { [@p1, @p2, @p3] }
142
+ tl = TripLeg.new(:trip_number=>100, :leg_number=>2, :verify_date=>0, :trip=>@t)
143
+ tl.passenger_list.should == "eric (lead pax)"
144
+ end
145
+
146
+ it "when leg has none in range" do
147
+ stub(@t).passengers { [@p1, @p2, @p3] }
148
+ tl = TripLeg.new(:trip_number=>100, :leg_number=>3, :verify_date=>0, :trip=>@t)
149
+ tl.passenger_list.should == ""
150
+ end
151
+
152
+ end
153
+
154
+ it "method total_trip_statute_miles returns a value" do
155
+ @t = Trip.new(:total_statute_miles=>100)
156
+ tl = TripLeg.new(:trip_number=>100, :leg_number=>3, :trip=>@t)
157
+ tl.total_trip_statute_miles.should == 10.0
158
+ end
159
+
160
+
161
+
162
+
163
+
164
+ describe 'crew brief fields' do
165
+ before :all do
166
+ set_fos_db([TripLeg, Comment])
167
+ @trip_leg = TripLeg.first(:trip_number=>50885, :leg_number=>1)
168
+ end
169
+
170
+ it "catering departure value" do
171
+ @trip_leg.catering_departure.should == 1
172
+ end
173
+
174
+ it "departure fbo comment value" do
175
+ @trip_leg.departure_fbo_comment_value.comment.should == "3028 Peacekeeper Way\r\nSacramento, CA 95652"
176
+ end
177
+
178
+ it "arrival fbo comment value" do
179
+ @trip_leg.arrival_fbo_comment_value.comment.should == "Auto-selected FBO not preferred"
180
+ end
181
+
182
+ it "catering comment value" do
183
+ @trip_leg.departure_catering_comment__comment.should == "Catering: Standard drinks and snacks for all live legs"
184
+ end
185
+
186
+ it "limo comment value" do
187
+ @trip_leg.arrival_transport_comment__comment.should == "Transportation: Passenger arranged for all live legs"
188
+ end
189
+
190
+ it "crew fbo comment value" do
191
+ @trip_leg.crew_fbo_comment_value.should == nil
192
+ end
193
+ end
201
194
 
202
195
  ## NEED TO REMOVE, TESTS SHOULD BE IN FlightLogExpense spec
203
196
  # describe "fuel passdown data columns" do
@@ -0,0 +1,26 @@
1
+ require 'fossil'
2
+ require 'logger'
3
+
4
+ DB = Sequel.fos('flyos', :loggers=>[Logger.new($stdout)])
5
+ [Trip,TripLeg].each{|m| m.db=DB}
6
+ #[Trip,TripLeg,Airport,AirportFbo,Aircraft,CrewLeg,Code,TripPassenger,Passenger,Personnel,Quote,Comment].each{|m| m.db=DB}
7
+ start_date = Date.parse('July 1 2010').to_fos_days
8
+ end_date = Date.parse('Aug 31 2010').to_fos_days
9
+ #p [start_date, end_date]
10
+ #p TripLeg.filter(:depart_date_key=> (start_date..end_date) ).count
11
+ #p Trip.filter(:departure_date_gmt=> (start_date..end_date) ).count
12
+ #t = TripLeg["PHIP", 0, 17, 40257, 974]
13
+ #t.update(:kid_date=>40256)
14
+ #t.update(:kid_date => 40247)
15
+
16
+ def diff_hash(arr)
17
+ Hash[*arr.collect{|v|[v[0],v[1]]}.flatten]
18
+ end
19
+
20
+ old_attrs = {:dan=>'cool',:jade=>'nice'}
21
+ new_attrs = {:dan=>'cool',:jade=>'there'}
22
+ old_diffs=diff_hash(old_attrs.to_a-new_attrs.to_a)
23
+ new_diffs=diff_hash(new_attrs.to_a-old_attrs.to_a)
24
+ old_diffs.each{|k,v| old_diffs[k] = [v,new_diffs[k]] if new_diffs[k] }
25
+
26
+
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 9
9
- version: 0.5.9
8
+ - 10
9
+ version: 0.5.10
10
10
  platform: ruby
11
11
  authors:
12
12
  - Patrick Lardin, Daniel Sudol
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-27 00:00:00 -07:00
17
+ date: 2010-10-29 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -210,6 +210,7 @@ files:
210
210
  - spec/sequel/serializer/xml_serializer_spec.rb
211
211
  - spec/sequel/spec_helper_tables.rb
212
212
  - spec/spec_helper.rb
213
+ - spec/silly_spec.rb
213
214
  has_rdoc: true
214
215
  homepage: ""
215
216
  licenses: []
@@ -255,6 +256,7 @@ test_files:
255
256
  - spec/sequel/serializer/json_serializer_spec.rb
256
257
  - spec/sequel/serializer/xml_serializer_spec.rb
257
258
  - spec/sequel/pervasive_adapter_spec.rb
259
+ - spec/silly_spec.rb
258
260
  - spec/helper_classes.rb
259
261
  - spec/models/code_spec.rb
260
262
  - spec/models/trip_leg_spec.rb