From c770458e6a7171e265d05f617c3abceeedc8c518 Mon Sep 17 00:00:00 2001 From: Renzo Lucioni Date: Mon, 15 Jul 2013 13:31:56 -0400 Subject: [PATCH 1/2] Reinstate problem_check event as Problem Checked event --- common/lib/xmodule/xmodule/js/src/capa/display.coffee | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/src/capa/display.coffee b/common/lib/xmodule/xmodule/js/src/capa/display.coffee index e29276936b64..fbbba36134d6 100644 --- a/common/lib/xmodule/xmodule/js/src/capa/display.coffee +++ b/common/lib/xmodule/xmodule/js/src/capa/display.coffee @@ -162,8 +162,9 @@ class @Problem # maybe preferable to consolidate all dispatches to use FormData ### check_fd: => - # Calling check from check_fd will result in firing the 'problem_check' event twice, since it is also called in the check function. - #Logger.log 'problem_check', @answers + # Calling check from check_fd will result in firing the 'problem_check' event twice, + # since it is also called in the check function. + # Logger.log 'problem_check', @answers # If there are no file inputs in the problem, we can fall back on @check if $('input:file').length == 0 @@ -239,6 +240,11 @@ class @Problem check: => @check_waitfor() Logger.log 'problem_check', @answers + + # Segment.io + analytics.track "Problem Checked", + answers: @answers + $.postWithPrefix "#{@url}/problem_check", @answers, (response) => switch response.success when 'incorrect', 'correct' From 92ae50d415ad19c6742d1797c64dc7618a53b5fd Mon Sep 17 00:00:00 2001 From: Renzo Lucioni Date: Mon, 15 Jul 2013 15:18:01 -0400 Subject: [PATCH 2/2] Remove unused code and include problem ID of data we send --- common/lib/xmodule/xmodule/js/src/capa/display.coffee | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/src/capa/display.coffee b/common/lib/xmodule/xmodule/js/src/capa/display.coffee index fbbba36134d6..b7dbf6864d20 100644 --- a/common/lib/xmodule/xmodule/js/src/capa/display.coffee +++ b/common/lib/xmodule/xmodule/js/src/capa/display.coffee @@ -22,7 +22,6 @@ class @Problem @$('section.action input:button').click @refreshAnswers @$('section.action input.check').click @check_fd - #@$('section.action input.check').click @check @$('section.action input.reset').click @reset @$('section.action button.show').click @show @$('section.action input.save').click @save @@ -162,10 +161,6 @@ class @Problem # maybe preferable to consolidate all dispatches to use FormData ### check_fd: => - # Calling check from check_fd will result in firing the 'problem_check' event twice, - # since it is also called in the check function. - # Logger.log 'problem_check', @answers - # If there are no file inputs in the problem, we can fall back on @check if $('input:file').length == 0 @check() @@ -243,6 +238,7 @@ class @Problem # Segment.io analytics.track "Problem Checked", + problem_id: @id answers: @answers $.postWithPrefix "#{@url}/problem_check", @answers, (response) =>