Commits

Rory McCann committed 1ac3a22

only create reports for today if you explicity set that

Comments (0)

Files changed (2)

experiments/reports.py

                                 GoalType)
 from experiments.significance import chi_square_p_value
 
+from django.conf import settings
+
 def calculate_participant_conversion(participant, goal_type, report_date):
     """
     Determines whether a specific participant achieved a specific goal_type
                         experiment=experiment, report_date=current_date)
                 current_date = current_date + timedelta(days=1)
 
-            # Do the reports for today.
-            # There might be reports already generated for today, they would not be complete
-            today = datetime.today().date()
-            self.report_model_class.objects.filter(experiment=experiment, date=today).delete()
-            self.generate_daily_report_for_experiment(
-                        experiment=experiment, report_date=today)
+            if getattr(settings, 'LEAN_CALC_REPORTS_FOR_TODAY', False):
+                # Do the reports for today.
+                # There might be reports already generated for today, they would not be complete
+                today = datetime.today().date()
+                self.report_model_class.objects.filter(experiment=experiment, date=today).delete()
+                self.generate_daily_report_for_experiment(
+                            experiment=experiment, report_date=today)
     
 
 class ConversionReportGenerator(BaseReportGenerator):

experiments/views.py

             else:
                 end_date = experiment.end_date
         else:
+            if getattr(settings, 'LEAN_CALC_REPORTS_FOR_TODAY', False):
+                # Create experiments for today
                 end_date = date.today()
+            else:
+                # Don't create experiments for today
+                end_date = date.today() - timedelta(days=1)
         current_date = end_date
         while current_date >= start_date:
             daily_engagement_data = None