app/controllers/cohortly/reports_controller.rb in cohortly-0.0.3 vs app/controllers/cohortly/reports_controller.rb in cohortly-0.0.4

- old
+ new

@@ -1,9 +1,12 @@ class Cohortly::ReportsController < Cohortly::CohortlyController def index @metric_search = Cohortly::Metric.new(params[:cohortly_metric]) tags = @metric_search.tags.any? ? @metric_search.tags : nil - Cohortly::Metric.cohort_chart_for_tag(tags) - @report = Cohortly::Report.new( Cohortly::Metric.report_table_name(tags) ) + report_name = Cohortly::Metric.report_table_name(tags) + unless Cohortly::Metric.database.collections.collect(&:name).include?( report_name ) + Cohortly::Metric.cohort_chart_for_tag(tags) + end + @report = Cohortly::Report.new( report_name ) end end