fossil 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/fossil.gemspec +1 -1
- data/lib/models/crew_leg.rb +2 -0
- data/lib/models/trip_leg.rb +9 -3
- data/lib/sequel/model_patch.rb +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.5
|
data/fossil.gemspec
CHANGED
data/lib/models/crew_leg.rb
CHANGED
@@ -8,6 +8,8 @@ class CrewLeg < Sequel::Model(:'crew legs')
|
|
8
8
|
# Code associations
|
9
9
|
code_association :position_code, :'position', :position
|
10
10
|
|
11
|
+
delegate :employee_name, :to => :crew_name
|
12
|
+
|
11
13
|
#### BEGIN GENERATED SECTION ####
|
12
14
|
set_primary_key [:'kid - user', :'kid - mult', :'kid - comm', :'kid - date', :'kid - time']
|
13
15
|
|
data/lib/models/trip_leg.rb
CHANGED
@@ -678,10 +678,16 @@ class TripLeg < Sequel::Model(:'trip legs')
|
|
678
678
|
|
679
679
|
# get pic or sic or purser for this trip leg. type should be :pic or :sic or :pur
|
680
680
|
def pilot_code(type)
|
681
|
-
|
682
|
-
|
683
|
-
return cl ? cl.crew : ''
|
681
|
+
crew_leg = pilot_crew(type)
|
682
|
+
crew_leg ? crew_leg.crew : ''
|
684
683
|
end
|
685
684
|
def pic; pilot_code(:pic); end
|
686
685
|
def sic; pilot_code(:sic); end
|
686
|
+
|
687
|
+
def pilot_crew(type)
|
688
|
+
return nil unless type
|
689
|
+
crew_legs.find{|cl| cl.position_code_code == type.to_s.upcase }
|
690
|
+
end
|
691
|
+
def pic_crew; pilot_crew(:pic); end
|
692
|
+
def sic_crew; pilot_crew(:sic); end
|
687
693
|
end
|
data/lib/sequel/model_patch.rb
CHANGED
@@ -18,7 +18,7 @@ class Sequel::Model
|
|
18
18
|
# create delegator on the fly
|
19
19
|
method_call = arr.shift
|
20
20
|
arr.each do |next_call|
|
21
|
-
unless respond_to?
|
21
|
+
unless respond_to?(method_call + "_" + next_call)
|
22
22
|
self.class.delegate next_call.to_sym, :to => method_call.to_sym, :prefix => true, :allow_nil => true
|
23
23
|
end
|
24
24
|
method_call = method_call + "_" + next_call
|