fossil 0.5.28 → 0.5.29
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 +2 -2
- data/lib/models/trip_leg.rb +8 -3
- data/lib/support/core_extensions.rb +0 -1
- data/spec/models/trip_leg_spec.rb +22 -9
- data/spec/silly_spec.rb +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.29
|
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.
|
8
|
+
s.version = "0.5.29"
|
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{2011-02-
|
12
|
+
s.date = %q{2011-02-16}
|
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 = [
|
data/lib/models/trip_leg.rb
CHANGED
@@ -672,10 +672,15 @@ class TripLeg < Sequel::Model(:'trip legs')
|
|
672
672
|
column_view :arrival_date_gmt, :date, :actual_arrival_date_gmt
|
673
673
|
column_view :arriv_time_act_gmt, :time, :actual_arrival_time_gmt
|
674
674
|
# Fixed to check if actual fields are populated, on older records these fields are not populated so we can't use them.
|
675
|
-
#
|
675
|
+
# Updated to calculated actual times based on dept datetime and block time actual.
|
676
|
+
# Jade Tucker 2/11/2011
|
676
677
|
def actual_arrival_date_time_gmt
|
677
|
-
|
678
|
-
|
678
|
+
if arr_date_act_gmt != 0 then
|
679
|
+
DateTime.from_fos_date_time(arr_date_act_gmt, arriv_time_act_gmt)
|
680
|
+
else
|
681
|
+
block_time_minutes = block_time_actual ? block_time_actual.minutes : 0
|
682
|
+
(actual_departure_date_time_gmt.to_time.utc + block_time_minutes).to_datetime
|
683
|
+
end
|
679
684
|
end
|
680
685
|
|
681
686
|
def actual_land_date_time_gmt
|
@@ -18,7 +18,6 @@ class Float
|
|
18
18
|
def in_hundredths
|
19
19
|
return 0 if self == 0
|
20
20
|
val = "#{self/60.0}.#{((100.0*(self.modulo(60.0)))/60.0).to_s.rjust(2, '0')}"
|
21
|
-
BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_HALF_EVEN)
|
22
21
|
BigDecimal.new(val, 2).round(2).to_f
|
23
22
|
end
|
24
23
|
end
|
@@ -80,7 +80,7 @@ describe TripLeg do
|
|
80
80
|
|
81
81
|
|
82
82
|
describe 'actual_land_date_time_gmt' do
|
83
|
-
it "actual_landing_date_time
|
83
|
+
it "actual_landing_date_time dates are before arr_date_act_gmt if on time time is greater than landing time" do
|
84
84
|
tl = TripLeg.new(:arr_date_act_gmt=> Date.new(1900, 1, 2).to_fos_days,
|
85
85
|
:land_time_act_gmt=> 1420,
|
86
86
|
:arriv_time_act_gmt=> 20)
|
@@ -96,19 +96,32 @@ describe TripLeg do
|
|
96
96
|
end
|
97
97
|
|
98
98
|
describe 'actual_arrival_date_time_gmt' do
|
99
|
-
it "
|
100
|
-
tl = TripLeg.new(:arr_date_act_gmt=> 0, #
|
101
|
-
:
|
102
|
-
:
|
103
|
-
|
99
|
+
it "doesn't have the new 'arr date act gmt' field set" do
|
100
|
+
tl = TripLeg.new(:arr_date_act_gmt=> 0, # new field not set
|
101
|
+
:dept_date_act_gmt => 1, # should calculate arrival date based on departure datetime and block time
|
102
|
+
:dept_time_act_gmt => 1340,
|
103
|
+
:block_time_actual => 130,
|
104
|
+
:arrival_date_gmt=> 2,
|
105
|
+
:arriv_time_act_gmt=> 0)
|
106
|
+
tl.actual_arrival_date_time_gmt.should == DateTime.new(1900, 1, 2, 0, 30, 0)
|
104
107
|
end
|
105
108
|
|
106
109
|
it "has the new 'arr date act gmt' field set" do
|
107
|
-
tl = TripLeg.new(:arr_date_act_gmt=> 2, #
|
108
|
-
:
|
109
|
-
:
|
110
|
+
tl = TripLeg.new(:arr_date_act_gmt=> 2, # new field is set, so use this one
|
111
|
+
:arriv_time_act_gmt=> 10,
|
112
|
+
:arrival_date_gmt=> 0)
|
110
113
|
tl.actual_arrival_date_time_gmt.should == DateTime.new(1900, 1, 2, 0, 10, 0)
|
111
114
|
end
|
115
|
+
|
116
|
+
it "doesnt have any actual fields set" do # occurs when trip leg has not been flown
|
117
|
+
tl = TripLeg.new(:arr_date_act_gmt => 0,
|
118
|
+
:arriv_time_act_gmt => 0,
|
119
|
+
:arrival_date_gmt => 2,
|
120
|
+
:block_time_actual => 0,
|
121
|
+
:dept_date_act_gmt => 0,
|
122
|
+
:dept_time_act_gmt => 1440)
|
123
|
+
tl.actual_arrival_date_time_gmt.should == DateTime.parse("1900-01-01T00:00:00+00:00") # we expect an invalid date here, accurate reflection of the data
|
124
|
+
end
|
112
125
|
end
|
113
126
|
|
114
127
|
it "actual_arrival_date_time_base are correctly calculating the tz offset" do
|
data/spec/silly_spec.rb
CHANGED
@@ -11,7 +11,7 @@ require 'pp'
|
|
11
11
|
#p TripLeg.select(:cancel_code).distinct(:cancel_code)
|
12
12
|
#p TripLeg.filter{ cancel_code >1 }.count
|
13
13
|
|
14
|
-
#p TripLeg.first(:trip_number=>85176,:leg_number=>
|
14
|
+
#p TripLeg.first(:trip_number=>85176,:leg_number=>1).fill_hash(
|
15
15
|
# [:cancel_code,:verify_date,:status,:flight_time_actual]
|
16
16
|
#)
|
17
17
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 0.5.
|
8
|
+
- 29
|
9
|
+
version: 0.5.29
|
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: 2011-02-
|
17
|
+
date: 2011-02-16 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|