fossil 0.5.37 → 0.5.38
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/dbr_models/flight_log_expense.rb +19 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.38
|
data/fossil.gemspec
CHANGED
@@ -1,3 +1,22 @@
|
|
1
1
|
class FlightLogExpense
|
2
|
+
|
2
3
|
many_to_one :trip_leg, :class=>:TripLeg, :key=>:trip_leg_id
|
4
|
+
|
5
|
+
def airport_fuel_lookup
|
6
|
+
if is_departure_expense?
|
7
|
+
date1, date2 = trip_leg.dept_date_act_local, trip_leg.depart_date_local
|
8
|
+
fbo_id = trip_leg.fueler_id
|
9
|
+
else
|
10
|
+
date1, date2 = trip_leg.arr_date_act_local, trip_leg.arrival_date_local
|
11
|
+
fbo_id = trip_leg.fbo_id
|
12
|
+
end
|
13
|
+
|
14
|
+
# I would prefer to this filter{ (effective_date <= date1) | (effective_date <= date2) }
|
15
|
+
# for filter, but does not work if date is nil
|
16
|
+
ap = AirportFuel.
|
17
|
+
filter('`effective date` <= ? or `effective date` <= ?', date1, date2).
|
18
|
+
filter(:vendor_id=>vendor_id).filter(:fbo_id=> fbo_id).order(:effective_date).
|
19
|
+
last
|
20
|
+
ap ? ap.values : {}
|
21
|
+
end
|
3
22
|
end
|