mdarby (owner)

Revisions

gist: 81964 Download_button fork
public
Public Clone URL: git://gist.github.com/81964.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# What is 'x', and what is 'hh'?
# How do I find "hours"?
 
 
x = 0.0
 
# defaults will contain the default percentages for a job type
defaults = discipline_defaults(job)
 
defaults.each_pair do |discipline, value| # :hvac => 0.10
  cost_per_hour = User.average_cost_per_hour_for_discipline(discipline)
  x += (0.01 * value * cost_per_hour) unless cost_per_hour.nan?
end
 
# 'fd' was the FeeDestination amount for the EmployeeGroup assigned to the Job.
hh = fd.amount / x
 
defaults.each_pair do |discipline, value|
  hours = hh * value / 100
end