From 18a56005b0dd0ec78a8ebbc440024e89867a128a Mon Sep 17 00:00:00 2001 From: Diana Huang Date: Thu, 21 Feb 2013 10:17:08 -0500 Subject: [PATCH] Address code review feedback - make category a data field of an input - namespace event types - don't try to use the track function when it doesn't exist - generate event types if it doesn't match a pre-existing pattern --- .../xmodule/js/src/combinedopenended/display.coffee | 13 +++++++++---- .../js/src/peergrading/peer_grading_problem.coffee | 4 ++-- .../open_ended_grading_classes/openendedchild.py | 5 ++++- .../coffee/src/staff_grading/staff_grading.coffee | 4 ++-- lms/templates/open_ended_rubric.html | 2 +- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee b/common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee index 224b33169a..931e3bf25d 100644 --- a/common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee +++ b/common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee @@ -8,7 +8,7 @@ class @Rubric @tracking_callback: (event) -> target_selection = $(event.target).val() # chop off the beginning of the name so that we can get the number of the category - category = $(event.target).prop("name").substring(16) + category = $(event.target).data("category") location = $('.rubric').data('location') # probably want the original problem location as well @@ -459,7 +459,9 @@ class @CombinedOpenEnded @prompt_container.toggleClass('open') if @question_header.text() == "(Hide)" new_text = "(Show)" + Logger.log 'oe_hide_question', {location: @location} else + Logger.log 'oe_show_question', {location: @location} new_text = "(Hide)" @question_header.text(new_text) @@ -478,10 +480,13 @@ class @CombinedOpenEnded log_feedback_click: (event) -> link_text = $(event.target).html() if link_text == 'See full feedback' - Logger.log 'show_full_feedback', {} + Logger.log 'oe_show_full_feedback', {} else if link_text == 'Respond to Feedback' - Logger.log 'show_respond_to_feedback', {} + Logger.log 'oe_show_respond_to_feedback', {} + else + generated_event_type = link_text.toLowerCase().replace(" ","_") + Logger.log "oe_" + generated_event_type, {} log_feedback_selection: (event) -> target_selection = $(event.target).val() - Logger.log 'feedback_response_selected', {value: target_selection} + Logger.log 'oe_feedback_response_selected', {value: target_selection} diff --git a/common/lib/xmodule/xmodule/js/src/peergrading/peer_grading_problem.coffee b/common/lib/xmodule/xmodule/js/src/peergrading/peer_grading_problem.coffee index 17a84dcf8b..7f85ea050e 100644 --- a/common/lib/xmodule/xmodule/js/src/peergrading/peer_grading_problem.coffee +++ b/common/lib/xmodule/xmodule/js/src/peergrading/peer_grading_problem.coffee @@ -471,9 +471,9 @@ class @PeerGradingProblem @prompt_container.slideToggle() @prompt_container.toggleClass('open') if @question_header.text() == "(Hide)" - Logger.log 'hide_question', {location: @location} + Logger.log 'peer_grading_hide_question', {location: @location} new_text = "(Show)" else - Logger.log 'show_question', {location: @location} + Logger.log 'peer_grading_show_question', {location: @location} new_text = "(Hide)" @question_header.text(new_text) diff --git a/common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py b/common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py index ffa7b6c7d3..2b90fdd848 100644 --- a/common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py +++ b/common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py @@ -341,7 +341,10 @@ class OpenEndedChild(object): if get_data['can_upload_files'] in ['true', '1']: has_file_to_upload = True file = get_data['student_file'][0] - self.system.track_function('open_ended_image_upload', {'filename': file.name}) + if self.system.track_fuction: + self.system.track_function('open_ended_image_upload', {'filename': file.name}) + else: + log.info("No tracking function found when uploading image.") uploaded_to_s3, image_ok, s3_public_url = self.upload_image_to_s3(file) if uploaded_to_s3: image_tag = self.generate_image_tag_from_url(s3_public_url, file.name) diff --git a/lms/static/coffee/src/staff_grading/staff_grading.coffee b/lms/static/coffee/src/staff_grading/staff_grading.coffee index f7768de01e..4edbce9ddb 100644 --- a/lms/static/coffee/src/staff_grading/staff_grading.coffee +++ b/lms/static/coffee/src/staff_grading/staff_grading.coffee @@ -443,10 +443,10 @@ class @StaffGrading @prompt_container.slideToggle() @prompt_container.toggleClass('open') if @question_header.text() == "(Hide)" - Logger.log 'hide_question', {location: @location} + Logger.log 'staff_grading_hide_question', {location: @location} new_text = "(Show)" else - Logger.log 'show_question', {location: @location} + Logger.log 'staff_grading_show_question', {location: @location} new_text = "(Hide)" @question_header.text(new_text) diff --git a/lms/templates/open_ended_rubric.html b/lms/templates/open_ended_rubric.html index 2cbab3ab3b..144cd829d9 100644 --- a/lms/templates/open_ended_rubric.html +++ b/lms/templates/open_ended_rubric.html @@ -14,7 +14,7 @@
  • % endif