From 669f61b2ea32ebf08f75e016d3b1eab179a8f963 Mon Sep 17 00:00:00 2001 From: Gabe Mulley Date: Thu, 22 Mar 2018 13:19:18 -0400 Subject: [PATCH 1/2] mark email sent events as non-interactions --- lms/djangoapps/discussion/tasks.py | 3 ++- openedx/core/djangoapps/schedules/tasks.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lms/djangoapps/discussion/tasks.py b/lms/djangoapps/discussion/tasks.py index 1c46efc66c..2072d36701 100644 --- a/lms/djangoapps/discussion/tasks.py +++ b/lms/djangoapps/discussion/tasks.py @@ -85,7 +85,8 @@ def _track_notification_sent(message, context): 'uuid': unicode(message.uuid), 'send_uuid': unicode(message.send_uuid), 'thread_id': context['thread_id'], - 'thread_created_at': date.deserialize(context['thread_created_at']) + 'thread_created_at': date.deserialize(context['thread_created_at']), + 'nonInteraction': 1, } analytics.track( user_id=context['thread_author_id'], diff --git a/openedx/core/djangoapps/schedules/tasks.py b/openedx/core/djangoapps/schedules/tasks.py index c368773c39..08b11dc46d 100644 --- a/openedx/core/djangoapps/schedules/tasks.py +++ b/openedx/core/djangoapps/schedules/tasks.py @@ -216,6 +216,7 @@ def _track_message_sent(site, user, msg): 'language': msg.language, 'uuid': unicode(msg.uuid), 'send_uuid': unicode(msg.send_uuid), + 'nonInteraction': 1, } course_ids = msg.context.get('course_ids', []) properties['num_courses'] = len(course_ids) From 83b24e045327fc63fc4287e9f62ae9b6aab0829a Mon Sep 17 00:00:00 2001 From: Gabe Mulley Date: Mon, 14 May 2018 13:21:49 -0400 Subject: [PATCH 2/2] fix broken test --- lms/djangoapps/discussion/tests/test_tasks.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lms/djangoapps/discussion/tests/test_tasks.py b/lms/djangoapps/discussion/tests/test_tasks.py index ff4191c33b..8164c7b66f 100644 --- a/lms/djangoapps/discussion/tests/test_tasks.py +++ b/lms/djangoapps/discussion/tests/test_tasks.py @@ -298,6 +298,8 @@ class TaskTestCase(ModuleStoreTestCase): for key, entry in test_props.items(): setattr(message, key, entry) + test_props['nonInteraction'] = True + with mock.patch('analytics.track') as mock_analytics_track: _track_notification_sent(message, context) mock_analytics_track.assert_called_once_with(