fossil 0.5.20 → 0.5.21
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/dbr_models/trip.rb +1 -1
- data/lib/models/crew_duty.rb +4 -6
- data/spec/sequel/core_patch_spec.rb +34 -33
- data/spec/silly_spec.rb +10 -3
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.21
|
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.21"
|
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-12-
|
12
|
+
s.date = %q{2010-12-20}
|
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/dbr_models/trip.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class Trip
|
2
2
|
one_to_many :passengers, :class => :TripPassenger, :key=>:trip_id, :primary_key=>:id
|
3
|
+
one_to_many :trip_legs, :class => :TripLeg, :key=>:'trip number', :primary_key=>:'trip number'
|
3
4
|
many_to_one :trip_requester, :class => :Passenger, :key=>:requester_id
|
4
5
|
many_to_one :quote, :class => :Quote, :key=>:quote_id
|
5
|
-
one_to_many :trip_legs, :class => :TripLeg, :key=>:'trip number', :primary_key=>:'trip number'
|
6
6
|
end
|
data/lib/models/crew_duty.rb
CHANGED
@@ -129,13 +129,11 @@ class CrewDuty < Sequel::Model(:'crew duty')
|
|
129
129
|
column_def_datetime :duty_end_time, :'act end date home', :'act end time home'
|
130
130
|
|
131
131
|
# Fetches the crew duty records in a given interval
|
132
|
-
def self.find_crew_duty_in_time_range(
|
132
|
+
def self.find_crew_duty_in_time_range(from_date, to_date)
|
133
133
|
# Fetching the records verified or amended in the time interval passed in
|
134
|
-
|
135
|
-
{:verified=>1, :amended=>0, :verified_date=>
|
136
|
-
{:verified=>1, :amended=>
|
137
|
-
{:verified=>1, :amended=>1, :amended_date=>from_datetime.to_fos_days, :amended_time=>(from_datetime.as_minutes..1440)} |
|
138
|
-
{:verified=>1, :amended=>1, :amended_date=>to_datetime.to_fos_days, :amended_time=>(0..to_datetime.as_minutes)}
|
134
|
+
filter(
|
135
|
+
{:verified=>1, :amended=>0, :verified_date=>from_date.to_fos_days..to_date.to_fos_days} |
|
136
|
+
{:verified=>1, :amended=>1, :amended_date=>from_date.to_fos_days..to_date.to_fos_days}
|
139
137
|
).all
|
140
138
|
end
|
141
139
|
end
|
@@ -2,51 +2,52 @@ require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
2
|
|
3
3
|
describe Sequel do
|
4
4
|
|
5
|
-
describe "has method 'fos' that" do
|
6
|
-
before :each do
|
7
|
-
@db = Sequel.fos('fos')
|
8
|
-
end
|
9
|
-
|
10
|
-
it "instantiates a fos/pervasive db from an odbc name" do
|
11
|
-
@db.should_not be nil
|
12
|
-
end
|
13
|
-
|
14
|
-
it "actually works to see a fos table" do
|
15
|
-
TripLeg.db=@db
|
16
|
-
TripLeg.first.should_not be nil
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# describe "has method 'fos_dbr' that" do
|
5
|
+
# describe "has method 'fos' that" do
|
21
6
|
# before :each do
|
22
|
-
#
|
23
|
-
# @db = Sequel.fos_dbr(hash)
|
7
|
+
# @db = Sequel.fos('fos')
|
24
8
|
# end
|
25
9
|
#
|
26
|
-
# it "instantiates
|
10
|
+
# it "instantiates a fos/pervasive db from an odbc name" do
|
27
11
|
# @db.should_not be nil
|
28
12
|
# end
|
29
13
|
#
|
30
|
-
# it "actually works to see
|
31
|
-
#
|
14
|
+
# it "actually works to see a fos table" do
|
15
|
+
# TripLeg.db=@db
|
32
16
|
# TripLeg.first.should_not be nil
|
33
|
-
# TripLeg.first.trip.should_not be nil
|
34
|
-
## p TripLeg.select(:trip_number).eager_graph(:trip).sql
|
35
|
-
## p TripLeg.filter(:id=>"WERJ-1-17-40385-1243").first
|
36
|
-
## p TripLeg.filter(:'trip legs__trip_number'=>68070,:leg_number=>5).eager_graph(:crew_legs => [:crew_name, :position_code]).sql
|
37
|
-
## t = TripLeg.filter(:'trip legs__trip_number'=>68070,:leg_number=>5).eager_graph(:crew_legs => [:crew_name, :position_code]).all.first
|
38
|
-
## p [t.status,t.division,t.regulation,t.closed,t.ete,t.department,t.deadhead,t.company]
|
39
|
-
## p TripLeg.filter(:id=>"WERJ-1-17-40385-1243").eager_graph(:aircraft).all.first
|
40
|
-
## TripLeg.filter(:'trip legs__kid_date'=>40475..40475, :cancel_code=>0,:leg_type_code=>7).eager_graph(:crew_legs=>:position_code).all.size.should == 3
|
41
17
|
# end
|
42
18
|
# end
|
43
19
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
20
|
+
describe "has method 'fos_dbr' that" do
|
21
|
+
before :each do
|
22
|
+
hash = {:host=>"localhost", :user=>'root', :password=>'', :database=>'test'}
|
23
|
+
@db = Sequel.fos_dbr(hash)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "instantiates dbr/mysql db from hash of params name" do
|
27
|
+
@db.should_not be nil
|
28
|
+
end
|
29
|
+
|
30
|
+
it "actually works to see dbr tables" do
|
31
|
+
[TripLeg,Trip,Quote,Aircraft,Code,CrewLeg].each{|model| model.db=@db}
|
32
|
+
# TripLeg.first.should_not be nil
|
33
|
+
# TripLeg.first.trip.should_not be nil
|
34
|
+
p Trip.eager_graph(:quote).sql
|
35
|
+
# p TripLeg.select(:trip_number).eager_graph(:trip).sql
|
36
|
+
# p TripLeg.filter(:id=>"WERJ-1-17-40385-1243").first
|
37
|
+
# p TripLeg.filter(:'trip legs__trip_number'=>68070,:leg_number=>5).eager_graph(:crew_legs => [:crew_name, :position_code]).sql
|
38
|
+
# t = TripLeg.filter(:'trip legs__trip_number'=>68070,:leg_number=>5).eager_graph(:crew_legs => [:crew_name, :position_code]).all.first
|
39
|
+
# p [t.status,t.division,t.regulation,t.closed,t.ete,t.department,t.deadhead,t.company]
|
40
|
+
# p TripLeg.filter(:id=>"WERJ-1-17-40385-1243").eager_graph(:aircraft).all.first
|
41
|
+
# TripLeg.filter(:'trip legs__kid_date'=>40475..40475, :cancel_code=>0,:leg_type_code=>7).eager_graph(:crew_legs=>:position_code).all.size.should == 3
|
42
|
+
end
|
48
43
|
end
|
49
44
|
|
45
|
+
# it "set_db method finds sets db on all Sequel models" do
|
46
|
+
# db = Sequel.fos('fos')
|
47
|
+
# Sequel.set_db db
|
48
|
+
# Trip.db.should == db
|
49
|
+
# end
|
50
|
+
|
50
51
|
it "converts fos_id to key that can be used to query model" do
|
51
52
|
Sequel.fos_id_to_lookup_key("MERE-0-8-40443-1259").should == ['MERE',0,8,40443,1259]
|
52
53
|
end
|
data/spec/silly_spec.rb
CHANGED
@@ -5,9 +5,15 @@ require 'pp'
|
|
5
5
|
# 800 557-9965
|
6
6
|
# 0279507735
|
7
7
|
|
8
|
-
DB = Sequel.fos('
|
8
|
+
DB = Sequel.fos('fosprod', :loggers=>[Logger.new($stdout)])
|
9
|
+
#DB = Sequel.fos('flyos', :loggers=>[Logger.new($stdout)])
|
10
|
+
CrewDuty.db = DB
|
9
11
|
|
10
|
-
|
12
|
+
date = Date.today - 1
|
13
|
+
pp CrewDuty.find_crew_duty_in_time_range(date, date).collect{|v| [v.duty_start_time.to_s, v.duty_end_time.to_s, v.amended, v.amended_date, v.verified_date] }
|
14
|
+
|
15
|
+
#[Personnel,Airport,TripLeg,AirportFbo].each{|m| m.db=DB}
|
16
|
+
#p Personnel.first(:employee_name.like('%chmo%'))
|
11
17
|
#[Trip,CrewLeg,TripLeg,Passenger,Aircraft,Airport,AirportFbo,CrewLeg,Code,Personnel,Comment].each{|m| m.db=DB}
|
12
18
|
#p TripLeg.all.collect{ |t| [t.pic,t.sic,t.departure_fbo__name,t.arrival_fbo__name]}
|
13
19
|
#t = Trip.filter(:trips__trip_number=>8).eager_graph(:trip_legs).all.first
|
@@ -20,7 +26,8 @@ DB = Sequel.fos('flyos', :loggers=>[Logger.new($stdout)])
|
|
20
26
|
# end
|
21
27
|
|
22
28
|
#p AirportFbo.filter(:icao=>'KSFO').count
|
23
|
-
DB.execute('Update "trip legs" set "
|
29
|
+
#DB.execute('Update "trip legs" set "lunch comment" = \'hi\' where "trip number" = 83100 and "leg number" = 3')
|
30
|
+
#DB.execute('Update "trip legs" set "pax count" = 6 where "trip number" = 62 and "leg number" = 1 ')
|
24
31
|
#tl = TripLeg.filter(:trip_number=>62,:leg_number=>1).first#eager_graph(:arrival_fbo).all.first
|
25
32
|
#p tl.fos_id
|
26
33
|
#p tl.pax_count
|
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
|
+
- 21
|
9
|
+
version: 0.5.21
|
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-12-
|
17
|
+
date: 2010-12-20 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|