fossil 0.5.42 → 0.5.43
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/flight_log_expense.rb +0 -9
- data/lib/models/trip_leg.rb +1 -1
- data/lib/sequel/model_patch.rb +3 -1
- data/lib/support/core_extensions.rb +2 -2
- data/spec/core_extensions_spec.rb +8 -0
- data/spec/silly_spec.rb +44 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.43
|
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.43"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Daniel Sudol", "Patrick Lardin"]
|
12
|
-
s.date = %q{2011-03-
|
12
|
+
s.date = %q{2011-03-21}
|
13
13
|
s.description = %q{Access FOS/betrieve db with this Sequel based orm wrapper}
|
14
14
|
s.email = %q{dansudol@yahoo.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -159,18 +159,9 @@ class FlightLogExpense < Sequel::Model(:'flight log expenses')
|
|
159
159
|
def fuel_passdown_hash
|
160
160
|
expense_type = type_string
|
161
161
|
tl = trip_leg
|
162
|
-
p expense_type
|
163
|
-
p tl
|
164
|
-
p vendor_id
|
165
|
-
p tl.send("#{expense_type}_fuel_vendor")
|
166
|
-
p tl.dep_fuel_vendor
|
167
|
-
p tl.arr_fuel_vendor
|
168
162
|
vendor = tl.send("#{expense_type}_fuel_vendor__company_2")
|
169
|
-
p vendor
|
170
163
|
vendor = tl.send("#{expense_type}_fuel_vendor__company_1") if !vendor or vendor == ""
|
171
|
-
p vendor
|
172
164
|
vendor = tl.send("#{expense_type}_fuel_vendor__vendor_id") if !vendor or vendor == ""
|
173
|
-
p vendor
|
174
165
|
airport = tl.send("#{expense_type}_icao_val")
|
175
166
|
fbo = tl.send("#{expense_type}_fbo__name")
|
176
167
|
aircraft = (tl.aircraft ? tl.tail_number : tl.aircraft_id)
|
data/lib/models/trip_leg.rb
CHANGED
@@ -950,7 +950,7 @@ class TripLeg < Sequel::Model(:'trip legs')
|
|
950
950
|
TripLeg.filter(:cancelled => 0, :status => [0,1,2]).
|
951
951
|
filter(~{:'leg state' => 5}).
|
952
952
|
filter({:'dept date act local' => start_date..end_date,
|
953
|
-
:'depart date - local' => start_date...end_date}.sql_or).
|
953
|
+
:'depart date - local' => start_date...end_date}.sql_or).all
|
954
954
|
end
|
955
955
|
|
956
956
|
def fuel_data_by_fbo_keys trip_legs, fbo_keys
|
data/lib/sequel/model_patch.rb
CHANGED
@@ -246,9 +246,11 @@ class Sequel::Model
|
|
246
246
|
when :time
|
247
247
|
Time.from_fos_time(column_value) if column_value
|
248
248
|
when :currency
|
249
|
+
# (column_value || 0).to_currency
|
249
250
|
number_to_currency((column_value || 0).to_f/100, :unit=>'', :precision=>2)
|
250
251
|
when :precision
|
251
|
-
|
252
|
+
# (column_value || 0).to_currency
|
253
|
+
# precision wont do delimiter .. so send to currency
|
252
254
|
number_to_currency((column_value || 0).to_f/100, :unit=>'', :precision=>2)
|
253
255
|
when :boolean
|
254
256
|
return "True" if column_value and (column_value == 1 or column_value == true)
|
@@ -40,8 +40,8 @@ class Float
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def to_currency
|
43
|
-
int, frac = self.round(2).
|
44
|
-
num = int.gsub(/(\d)(?=(\d\d\d)+(
|
43
|
+
int, frac = sprintf('%0.2f', self.round(2)).split('.')
|
44
|
+
num = int.gsub(/(\d)(?=(\d\d\d)+(?!\d))/, '\\1,')
|
45
45
|
"$#{num}.#{frac}"
|
46
46
|
end
|
47
47
|
end
|
@@ -35,6 +35,10 @@ describe Integer do
|
|
35
35
|
i = 10343
|
36
36
|
i.in_hundredths.should == 172.38
|
37
37
|
end
|
38
|
+
|
39
|
+
it "should be able to convert to a currency string" do
|
40
|
+
123423.to_currency.should == "$123,423.00"
|
41
|
+
end
|
38
42
|
end
|
39
43
|
|
40
44
|
describe Float do
|
@@ -47,6 +51,10 @@ describe Float do
|
|
47
51
|
i = 10343.56
|
48
52
|
i.in_hundredths.should == 172.39
|
49
53
|
end
|
54
|
+
|
55
|
+
it "should be able to convert to a currency string" do
|
56
|
+
123423.5673.to_currency.should == "$123,423.57"
|
57
|
+
end
|
50
58
|
end
|
51
59
|
|
52
60
|
describe Range do
|
data/spec/silly_spec.rb
CHANGED
@@ -1,6 +1,27 @@
|
|
1
1
|
require_relative '../lib/fossil'
|
2
2
|
require 'logger'
|
3
|
+
#require 'fossil_dbr'
|
3
4
|
require 'pp'
|
5
|
+
require 'active_record'
|
6
|
+
|
7
|
+
class TripLegSummary < ActiveRecord::Base
|
8
|
+
set_table_name :trip_leg_summary
|
9
|
+
h = {"adapter"=>"mysql", "username"=>"flyos", "password"=>"flyos", "host"=>"localhost", "database"=>"flyos_fos_summary"}
|
10
|
+
establish_connection h
|
11
|
+
end
|
12
|
+
p TripLegSummary.first
|
13
|
+
|
14
|
+
old_summary_values=
|
15
|
+
{:id=>"CTA-2-17-38922-1090",
|
16
|
+
:trip_requester=>"Wayne,John",
|
17
|
+
:pic=>"JS",
|
18
|
+
:sic=>"RBB",
|
19
|
+
:fuel_burned=>0,
|
20
|
+
:fuel_vendor=>"None",
|
21
|
+
:fueler_flags=>0,
|
22
|
+
:fbo_flags=>Date.today
|
23
|
+
}
|
24
|
+
|
4
25
|
|
5
26
|
#class Sequel::Model::Associations::OneToManyAssociationReflection
|
6
27
|
# # one_to_many associations can only have associated objects if none of
|
@@ -9,16 +30,37 @@ require 'pp'
|
|
9
30
|
# !self[:primary_keys].any?{|k| obj.send(k).nil?}
|
10
31
|
# end
|
11
32
|
#end
|
33
|
+
#h = {"adapter"=>"mysql", "username"=>"datamart", "password"=>"datap@ss", "host"=>"hrkdm.pcmt.local", "database"=>"dbr"}
|
34
|
+
#DB = Sequel.fos_dbr(h)
|
35
|
+
DB = Sequel.fos('flyos', :loggers=>[Logger.new($stdout)])
|
36
|
+
#DB.loggers=[Logger.new($stdout)]#File.expand_path("log/#{RAILS_ENV}.log"))]
|
37
|
+
[TripLeg, Aircraft].each { |model| model.db = DB }
|
38
|
+
#p [TripLeg.min(:kid_date),TripLeg.max(:kid_date)]
|
39
|
+
#p [Date.from_fos_days(TripLeg.min(:kid_date)),Date.from_fos_days(TripLeg.max(:kid_date))]
|
40
|
+
#p [Date.from_fos_days(TripLeg.min(:depart_date_local)),Date.from_fos_days(TripLeg.max(:depart_date_local))]
|
41
|
+
#p Date.from_fos_days 38922
|
12
42
|
|
13
43
|
#DB = Sequel.fos('fosprod', :loggers=>[Logger.new($stdout)])
|
14
44
|
#DB = Sequel.fos('fos', :loggers=>[Logger.new($stdout)])
|
15
45
|
#DB = Sequel.fos('demo_company_fos_db')#, :loggers=>[Logger.new($stdout)])
|
16
|
-
DB = Sequel.fos('flyos', :loggers=>[Logger.new($stdout)])
|
46
|
+
#DB = Sequel.fos('flyos', :loggers=>[Logger.new($stdout)])
|
17
47
|
#[CityPair,CityCost].each {|model| model.db = DB}
|
18
48
|
#p CityPair.first.city_costs
|
19
49
|
#p CityPair.first.send('kid - user')
|
20
50
|
#[TripLeg].each {|model| model.db = DB}
|
21
|
-
p
|
51
|
+
#p TripLeg.filter(:trip_number=>45,:leg_number=>1).first.arrival_transport_comment
|
52
|
+
#p Comment.filter(:kid_date=>38922,:kid_time=>1090,:kid_mult=>2,:kid_comm=>37).count
|
53
|
+
#p Aircraft.all.collect &:aircraft_id
|
54
|
+
|
55
|
+
#aircraft_ids = ["7RN", "45FM", "567T", "65PC", "67AS", "7NPN", "567Y", "89TY", "334D", "199J", "344D"]
|
56
|
+
#aircraft_id = TripLeg.filter(:trip_number=>45,:leg_number=>1).first.aircraft_id
|
57
|
+
#index = aircraft_ids.index(aircraft_id)
|
58
|
+
#next_index = index == aircraft_ids.length-1 ? 0 : index + 1
|
59
|
+
#p aircraft_ids[next_index]
|
60
|
+
#DB.run("UPDATE \"TRIP LEGS\" SET \"aircraft id\" = '#{aircraft_ids[next_index]}' WHERE (\"TRIP NUMBER\" = 45) AND (\"LEG NUMBER\" = 1)")
|
61
|
+
|
62
|
+
|
63
|
+
#p DB.run("UPDATE \"TRIP LEGS\" SET \"NOTE\" = 'hi rob' WHERE (\"TRIP NUMBER\" = 45) AND (\"LEG NUMBER\" = 1)")
|
22
64
|
#p TripLeg.filter(:trip_number=>45,:leg_number=>1).first.note
|
23
65
|
#tl = TripLeg.filter(:trip_number=>45,:leg_number=>1).first
|
24
66
|
#tl.note = "hi tob"
|
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
|
+
- 43
|
9
|
+
version: 0.5.43
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Daniel Sudol
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-21 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|