lib/timesheet/toggl/parser.rb
# description without @hours gets 1/n of all time, where n is count of descriptions.
#
description without @hours gets 1/n of all time, where n is count of descriptions.
description without @hours gets 1 / n of all time where n is count of descriptions .
def descriptions_with_hours(total_hours)
      d = descriptions_with_time_parts
      times = d.values.reject(&:zero?)
      if times.empty?
        one_part = 0
      else
        one_part = (times.size / d.size.to_f) * total_hours / times.inject(&:+)
      end
      d.inject({}) do |r, (k, v)|
        r.merge(k => (v.zero? ? (total_hours / d.size) : (one_part * v)))
      end
    end
def descriptions_with_hours ( total_hours ) d = descriptions_with_time_parts times = d . values . reject ( & :zero? ) if times . empty? one_part = 0 else one_part = ( times . size / d . size . to_f ) * total_hours / times . inject ( & :+ ) end d . inject ( { } ) do | r , ( k , v ) | r . merge ( k => ( v . zero? ? ( total_hours / d . size ) : ( one_part * v ) ) ) end end
description without @hours gets 1/n of all time, where n is count of descriptions.
description without @hours gets 1 / n of all time where n is count of descriptions .
total_hours
<not_specific>