Skip to content

Commit

Permalink
fix(periodic-digest): don't show completed experiments in launched li…
Browse files Browse the repository at this point in the history
…st (#27186)
  • Loading branch information
raquelmsmith authored Dec 30, 2024
1 parent 9002bfe commit 65067f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 10 additions & 2 deletions posthog/tasks/periodic_digest.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,16 @@ def get_teams_with_new_playlists(end: datetime, begin: datetime) -> QuerySet:


def get_teams_with_new_experiments_launched(end: datetime, begin: datetime) -> QuerySet:
return Experiment.objects.filter(start_date__gt=begin, start_date__lte=end).values(
"team_id", "name", "id", "start_date"
return (
Experiment.objects.filter(
start_date__gt=begin,
start_date__lte=end,
)
.exclude(
end_date__gt=begin,
end_date__lte=end,
)
.values("team_id", "name", "id", "start_date")
)


Expand Down
4 changes: 2 additions & 2 deletions posthog/tasks/test/test_periodic_digest.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ def test_periodic_digest_report(self, mock_capture: MagicMock) -> None:
completed_experiment = Experiment.objects.create(
team=self.team,
name="Completed Experiment",
start_date=now() + timedelta(days=1),
end_date=now() + timedelta(days=6),
start_date=now() + timedelta(days=6),
end_date=now() + timedelta(days=7),
feature_flag=flag_for_completed_experiment,
)

Expand Down

0 comments on commit 65067f2

Please sign in to comment.