Ported more items to the new Rate API. #1924
This commit is contained in:
@@ -114,8 +114,8 @@ class Budget
|
||||
|
||||
# Find each Member for their rate
|
||||
time_logs.each do |time_log|
|
||||
member = Member.find_by_user_id_and_project_id(time_log.user_id, time_log.project_id)
|
||||
total += (member.rate * time_log.hours) unless member.nil? || member.rate.nil?
|
||||
rate = Rate.amount_for(time_log.user, time_log.project, time_log.spent_on.to_s)
|
||||
total += (rate * time_log.hours) unless rate.nil?
|
||||
end
|
||||
|
||||
return total
|
||||
@@ -135,10 +135,9 @@ class Budget
|
||||
|
||||
time_logs = missing_issues.collect(&:time_entries).flatten
|
||||
|
||||
# Find each Member for their rate
|
||||
time_logs.each do |time_log|
|
||||
member = Member.find_by_user_id_and_project_id(time_log.user_id, time_log.project_id)
|
||||
total += (member.rate * time_log.hours) unless member.nil? || member.rate.nil?
|
||||
rate = Rate.amount_for(time_log.user, time_log.project, time_log.spent_on.to_s)
|
||||
total += (rate * time_log.hours) unless rate.nil?
|
||||
end
|
||||
|
||||
return total
|
||||
|
||||
@@ -24,12 +24,14 @@ class MemberSpent
|
||||
|
||||
project.members.each do |member|
|
||||
member_time_entries = time_entries.select { |tl| tl.user_id == member.user.id}
|
||||
hours = member_time_entries.collect(&:hours).sum || 0.0
|
||||
|
||||
spent = 0.0
|
||||
hours = 0.0
|
||||
|
||||
unless member.rate.nil?
|
||||
spent = hours.to_f * member.rate
|
||||
else
|
||||
spent = 0.0
|
||||
member_time_entries.each do |time_entry|
|
||||
rate = Rate.amount_for(time_entry.user, time_entry.project, time_entry.spent_on.to_s)
|
||||
spent += time_entry.hours.to_f * rate unless rate.nil?
|
||||
hours += time_entry.hours
|
||||
end
|
||||
|
||||
membership << MemberSpent.new({
|
||||
|
||||
Reference in New Issue
Block a user