Class: BBNW::RecordedActivity

Inherits:
Object
  • Object
show all
Extended by:
InvoiceDisplayUtils
Defined in:
lib/adapters/time_estimators/recorded_activity.rb

Class Method Summary collapse

Methods included from InvoiceDisplayUtils

company, display_price, header, message_display

Methods included from DateTimeUtils

#is_number?, #long_date, #long_date_time, #long_time, #parse_time, #short_date, #short_time, #time_description

Class Method Details

.line_items(activities_span, repository_adapter, meetings = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/adapters/time_estimators/recorded_activity.rb', line 7

def self.line_items(activities_span, repository_adapter, meetings = {})
  line_items     = {}
  activities     = activities_span.activities
  commits        = repository_adapter.commits

  all_activity   = activities.concat(commits)
  all_activity.sort! { |a, b| a.end_time <=> b.end_time }

  activity_block = []
  current_time   = all_activity.first.end_time

  all_activity.each_with_index do |activity, index|
    if day_changed?(activity, current_time)
      record_daily_activity(activity_block, line_items, all_activity, current_time, index)
      current_time = activity.end_time
    end

    if activity.is_a?(BBNW::Activity)
      activity_block << activity
    elsif activity.is_a?(BBNW::Commit)
      record_activities(activity_block, line_items, activity)
    end

    debug_output(activity)
  end

  line_items
end