Commit ec1780a8 by Tyler Hallada

Add DISTINCT to distinct_entity_count query

parent 1ba61f24
...@@ -413,7 +413,7 @@ class ModuleEngagementTimelineManager(models.Manager): ...@@ -413,7 +413,7 @@ class ModuleEngagementTimelineManager(models.Manager):
queryset = ModuleEngagement.objects.all().filter(course_id=course_id, username=username) \ queryset = ModuleEngagement.objects.all().filter(course_id=course_id, username=username) \
.values('date', 'entity_type', 'event') \ .values('date', 'entity_type', 'event') \
.annotate(total_count=Sum('count')) \ .annotate(total_count=Sum('count')) \
.annotate(distinct_entity_count=Count('entity_id')) \ .annotate(distinct_entity_count=Count('entity_id', distinct=True)) \
.order_by('date') .order_by('date')
timelines = [] timelines = []
......
...@@ -61,7 +61,7 @@ class EngagementTimelineTests(DemoCourseMixin, VerifyCourseIdMixin, TestCaseWith ...@@ -61,7 +61,7 @@ class EngagementTimelineTests(DemoCourseMixin, VerifyCourseIdMixin, TestCaseWith
] ]
} }
if expect_id_aggregation: if expect_id_aggregation:
expected_data['days'][0][metric_display_name] = 2 expected_data['days'][0][metric_display_name] = 1
else: else:
expected_data['days'][0][metric_display_name] = 10 expected_data['days'][0][metric_display_name] = 10
path = self.path_template.format(self.DEFAULT_USERNAME, urlquote(self.course_id)) path = self.path_template.format(self.DEFAULT_USERNAME, urlquote(self.course_id))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment