Class: IWonder::Report

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/i_wonder/report.rb

Instance Method Summary collapse

Instance Method Details

#bar?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'app/models/i_wonder/report.rb', line 15

def bar?
  report_type =~ /bar/i
end

#collect_series_data(start_time = nil, end_time = nil, interval_length = nil) ⇒ Object



38
39
40
41
42
# File 'app/models/i_wonder/report.rb', line 38

def collect_series_data(start_time = nil, end_time = nil, interval_length = nil)
  if line?
    collect_line_series(start_time, end_time, interval_length)
  end
end

#line?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'app/models/i_wonder/report.rb', line 12

def line?
  report_type =~ /line/i
end

#metric_idsObject



33
34
35
# File 'app/models/i_wonder/report.rb', line 33

def metric_ids
  self.metrics.collect(&:ids)
end

#metric_ids=(new_metric_ids) ⇒ Object



25
26
27
28
29
30
31
# File 'app/models/i_wonder/report.rb', line 25

def metric_ids=(new_metric_ids)
  self.report_memberships.each(&:mark_for_destruction)
  
  new_metric_ids.uniq.each{|metric_id|
    self.report_memberships.build(:metric_id => metric_id)
  }
end

#pie?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/models/i_wonder/report.rb', line 18

def pie?
  report_type =~ /pie/i
end

#test?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'app/models/i_wonder/report.rb', line 21

def test?
  report_type =~ /test/i
end