def track_comment_created_event(request, course, comment, commentable_id, followed):
 obj_type = ('comment' if comment.get('parent_id') else 'response')
 event_name = _EVENT_NAME_TEMPLATE.format(obj_type=obj_type, action_name='created')
 event_data = {'discussion': {'id': comment.thread_id}, 'commentable_id': commentable_id, 'options': {'followed': followed}}
 parent_id = comment.get('parent_id')
 if parent_id:
  event_data['response'] = {'id': parent_id}
 track_created_event(request, event_name, course, comment, event_data)

def track_comment_created_event ( request , course , comment , commentable_id , followed ) : obj_type = ( 'comment' if comment . get ( 'parent_id' ) else 'response' ) event_name = _EVENT_NAME_TEMPLATE . format ( obj_type = obj_type , action_name = 'created' ) event_data = { 'discussion' : { 'id' : comment . thread_id } , 'commentable_id' : commentable_id , 'options' : { 'followed' : followed } } parent_id = comment . get ( 'parent_id' ) if parent_id : event_data [ 'response' ] = { 'id' : parent_id } track_created_event ( request , event_name , course , comment , event_data )
send analytics event for a newly created response or comment .