Commit 1dbec29c by ajpal

Merge pull request #120 from edx/ajpal/fix-attempts-per-completed

Fix bug where problem attempts per completed was not showing
parents 600a7574 489e0f6d
from analytics_data_api.constants import engagement_entity_types from analytics_data_api.constants import engagement_entity_types
ATTEMPTED = 'attempted' ATTEMPTED = 'attempted'
ATTEMPTS_PER_COMPLETED = 'attempts_per_completed'
COMPLETED = 'completed' COMPLETED = 'completed'
CONTRIBUTED = 'contributed' CONTRIBUTED = 'contributed'
VIEWED = 'viewed' VIEWED = 'viewed'
...@@ -8,7 +9,7 @@ VIEWED = 'viewed' ...@@ -8,7 +9,7 @@ VIEWED = 'viewed'
# map entity types to events # map entity types to events
EVENTS = { EVENTS = {
engagement_entity_types.DISCUSSION: [CONTRIBUTED], engagement_entity_types.DISCUSSION: [CONTRIBUTED],
engagement_entity_types.PROBLEM: [ATTEMPTED, COMPLETED], engagement_entity_types.PROBLEM: [ATTEMPTED, ATTEMPTS_PER_COMPLETED, COMPLETED],
engagement_entity_types.PROBLEMS: [ATTEMPTED, COMPLETED], engagement_entity_types.PROBLEMS: [ATTEMPTED, COMPLETED],
engagement_entity_types.VIDEO: [VIEWED], engagement_entity_types.VIDEO: [VIEWED],
engagement_entity_types.VIDEOS: [VIEWED], engagement_entity_types.VIDEOS: [VIEWED],
......
...@@ -647,3 +647,14 @@ class CourseLearnerMetadataTests(DemoCourseMixin, VerifyCourseIdMixin, ...@@ -647,3 +647,14 @@ class CourseLearnerMetadataTests(DemoCourseMixin, VerifyCourseIdMixin,
response = self._get(self.course_id) response = self._get(self.course_id)
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
self.assertDictContainsSubset(expected, json.loads(response.content)) self.assertDictContainsSubset(expected, json.loads(response.content))
def test_engagement_ranges_fields(self):
actual_entity_types = engagement_entity_types.INDIVIDUAL_TYPES
expected_entity_types = ['discussion', 'problem', 'video']
self.assertEqual(actual_entity_types, expected_entity_types)
actual_events = []
for entity_type in actual_entity_types:
for event in engagement_events.EVENTS[entity_type]:
actual_events.append(event)
expected_events = ['contributed', 'attempted', 'attempts_per_completed', 'completed', 'viewed']
self.assertEqual(actual_events, expected_events)
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