From 9a555eb02ca08a6afbc2e577900e987ca7d06d2c Mon Sep 17 00:00:00 2001 From: Sofia Yoon Date: Wed, 21 Jul 2021 11:26:26 -0400 Subject: [PATCH] feat: log event for custom pacing when user submits relative date for self paced course (AA-921) --- .../js/views/modals/course_outline_modals.js | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/cms/static/js/views/modals/course_outline_modals.js b/cms/static/js/views/modals/course_outline_modals.js index 020fa384fa..4349e9646f 100644 --- a/cms/static/js/views/modals/course_outline_modals.js +++ b/cms/static/js/views/modals/course_outline_modals.js @@ -453,19 +453,29 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview', }, getRequestData: function() { + // Grab all the sections, map them to their block_ids, then return as an Array + var sectionIds = $('.outline-section').map(function(){return this.id;}).get() + // Grab all the subsections, map them to their block_ids, then return as an Array + var subsectionIds = $('.outline-subsection').map(function(){return this.id;}).get() + var relative_weeks_due = null; if (this.getValue() < 19 && this.getValue() > 0 && $('#grading_type').val() !== 'notgraded') { - return { - metadata: { - relative_weeks_due: this.getValue() - } - }; - } else { - return { - metadata: { - relative_weeks_due: null - } - } + relative_weeks_due = this.getValue() } + window.analytics.track('edx.bi.studio.relative_date.saved', { + block_id: this.model.get('id'), + courserun_key: course.get('id'), + num_of_sections_in_course: $('.outline-section').length, + num_of_subsections_in_course: $('.outline-subsection').length, + order_in_sections: sectionIds.indexOf(this.parent.options.parentInfo.get('id')) + 1, + order_in_subsections: subsectionIds.indexOf(this.model.get('id')) + 1, + org_key: course.get('org'), + relative_weeks_due: relative_weeks_due, + }); + return { + metadata: { + relative_weeks_due: relative_weeks_due + } + }; }, });