only send learning analytics events when specified in config.

This commit is contained in:
Ralf Teusner
2016-11-23 17:06:14 +01:00
parent d9cc9d17cf
commit 84b9b4a622

View File

@ -29,7 +29,11 @@ var CodeOceanEditor = {
lastCopyText: null,
configureEditors: function () {
<% @config ||= CodeOcean::Config.new(:code_ocean).read(erb: false) %>
sendLearningAnalyticEvents: <%= @config['codeocean_events']['enabled'] %>,
learningAnalyticsURL: "<%= @config['codeocean_events']['url'] %>",
configureEditors: function () {
_.each(['modePath', 'themePath', 'workerPath'], function (attribute) {
ace.config.set(attribute, this.ACE_FILES_PATH);
}.bind(this));
@ -363,7 +367,9 @@ var CodeOceanEditor = {
panel.find('.row .col-sm-9').eq(4).find('a').attr('href', '#output-' + index);
},
// move URL to config file, only fire event if desired.
publishCodeOceanEvent: function (eventName, contextData) {
if(this.sendLearningAnalyticEvents){
// enhance contextData hash with the user agent
contextData['user_agent'] = navigator.userAgent;
@ -386,7 +392,7 @@ var CodeOceanEditor = {
in_context: contextData
};
$.ajax("https://open.hpi.de/lanalytics/log", {
$.ajax(this.learningAnalyticsURL, {
type: 'POST',
cache: false,
dataType: 'JSON',
@ -394,6 +400,8 @@ var CodeOceanEditor = {
success: {},
error: {}
})
}
},
sendError: function (message, submission_id) {
@ -552,6 +560,7 @@ var CodeOceanEditor = {
$('#description-symbol').toggleClass('fa-chevron-right');
},
initializeEverything: function() {
this.initializeRegexes();
this.initializeCodePilot();