Ported more items to the new Rate API. #1924
This commit is contained in:
1 parent
045f50e0dd
commit
7fa4f33748
2 files changed
+11
-10
No files matched your search
@@ -114,8 +114,8 @@ class Budget
|
|||||||
|
|
||||||
# Find each Member for their rate
|
# Find each Member for their rate
|
||||||
time_logs.each do |time_log|
|
time_logs.each do |time_log|
|
||||||
member = Member.find_by_user_id_and_project_id(time_log.user_id, time_log.project_id)
|
rate = Rate.amount_for(time_log.user, time_log.project, time_log.spent_on.to_s)
|
||||||
total += (member.rate * time_log.hours) unless member.nil? || member.rate.nil?
|
total += (rate * time_log.hours) unless rate.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
return total
|
return total
|
||||||
@@ -135,10 +135,9 @@ class Budget
|
|||||||
|
|
||||||
time_logs = missing_issues.collect(&:time_entries).flatten
|
time_logs = missing_issues.collect(&:time_entries).flatten
|
||||||
|
|
||||||
# Find each Member for their rate
|
|
||||||
time_logs.each do |time_log|
|
time_logs.each do |time_log|
|
||||||
member = Member.find_by_user_id_and_project_id(time_log.user_id, time_log.project_id)
|
rate = Rate.amount_for(time_log.user, time_log.project, time_log.spent_on.to_s)
|
||||||
total += (member.rate * time_log.hours) unless member.nil? || member.rate.nil?
|
total += (rate * time_log.hours) unless rate.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
return total
|
return total
|
||||||
|
|||||||
@@ -24,12 +24,14 @@ class MemberSpent
|
|||||||
|
|
||||||
project.members.each do |member|
|
project.members.each do |member|
|
||||||
member_time_entries = time_entries.select { |tl| tl.user_id == member.user.id}
|
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?
|
member_time_entries.each do |time_entry|
|
||||||
spent = hours.to_f * member.rate
|
rate = Rate.amount_for(time_entry.user, time_entry.project, time_entry.spent_on.to_s)
|
||||||
else
|
spent += time_entry.hours.to_f * rate unless rate.nil?
|
||||||
spent = 0.0
|
hours += time_entry.hours
|
||||||
end
|
end
|
||||||
|
|
||||||
membership << MemberSpent.new({
|
membership << MemberSpent.new({
|
||||||
|
|||||||
Reference in new issue
Block a user