lib/herodot/worklog.rb in herodot-0.1.4 vs lib/herodot/worklog.rb in herodot-0.1.5
- old
+ new
@@ -43,14 +43,18 @@
def totals
grouped = logs_with_times_cleaned.group_by { |time| time[:date] }
dates.map do |date|
time_sums = grouped[date].each_with_object({}) do |time, sums|
id = time[:id]
- sums[id] ||= { time: 0, project: @branches.dig(id, :project), branch: @branches.dig(id, :branch) }
+ sums[id] ||= { time: 0, **branch(id) }
sums[id][:time] += time[:time]
end
[date, time_sums]
end
+ end
+
+ def branch(id)
+ @branches.fetch(id, {})
end
def dates
@raw_logs.map { |log| log[:time].to_date }.uniq.sort
end