Skip to content

Instantly share code, notes, and snippets.

@opsb
Created November 9, 2012 15:39
Show Gist options
  • Select an option

  • Save opsb/4046381 to your computer and use it in GitHub Desktop.

Select an option

Save opsb/4046381 to your computer and use it in GitHub Desktop.
module Reports
module CauseCumulativeCommission
extend self
def build(name, cause, opts=ReportOptions.new)
{
:name => name,
:columns => [['date', 'Date'], ['number', cause.name]],
:rows => begin
(opts.start_date..opts.end_date).step.inject([]) do |rows, date|
rows << [date, cause.metrics.commission(date).round(2)]
rows
end
end,
:options => {
chartArea: { width: '90%', height: '75%' },
legend: 'bottom'
}
}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment