app/controllers/cohortly/reports_controller.rb in cohortly-0.0.7 vs app/controllers/cohortly/reports_controller.rb in cohortly-0.0.8
- old
+ new
@@ -2,15 +2,24 @@
def index
Cohortly::Metric.send :attr_accessor, :groups
@metric_search = Cohortly::Metric.new(params[:cohortly_metric])
tags = @metric_search.tags.any? ? @metric_search.tags : nil
groups = @metric_search.groups
- @report_name = Cohortly::Metric.report_table_name(tags, groups, true)
+
+ @report_name = Cohortly::Metric.report_table_name(tags, groups, true)
# run this in background would be better
- Cohortly::Metric.weekly_cohort_chart_for_tag(tags, groups)
+
+ if Cohortly::Metric.respond_to? :delay
+ Cohortly::Metric.delay.weekly_cohort_chart_for_tag(tags, groups)
+ else
+ Cohortly::Metric.weekly_cohort_chart_for_tag(tags, groups)
+ end
@report = Cohortly::Report.new( tags, groups, true )
+
respond_to do |format|
format.html
- format.js { render :json => @report }
+ format.js {
+ render :json => @report
+ }
end
end
end