add cause to testruns

trigger run and assess on request_for_comment
This commit is contained in:
Ralf Teusner
2017-09-13 13:28:31 +02:00
parent 8f372bab04
commit ae1e465d1f
8 changed files with 53 additions and 18 deletions

View File

@@ -59,8 +59,6 @@ CodeOceanEditorCodePilot = {
}
};
//Request for comments does currently not work on staging platform (no relative root_url used here).
//To fix this rely on ruby routes
CodeOceanEditorRequestForComments = {
requestComments: function () {
var user_id = $('#editor').data('user-id');
@@ -83,6 +81,8 @@ CodeOceanEditorRequestForComments = {
}).done(function () {
this.hideSpinner();
$.flash.success({text: $('#askForCommentsButton').data('message-success')});
// trigger a run
this.runSubmission.call(this, submission);
}.bind(this)).error(this.ajaxError.bind(this));
};

View File

@@ -142,19 +142,21 @@ CodeOceanEditorSubmissions = {
* Execution-Logic
*/
runCode: function(event) {
event.preventDefault();
if ($('#run').is(':visible')) {
this.createSubmission('#run', null, function(response) {
//Run part starts here
$('#stop').data('url', response.stop_url);
this.running = true;
this.showSpinner($('#run'));
$('#score_div').addClass('hidden');
this.toggleButtonStates();
var url = response.run_url.replace(this.FILENAME_URL_PLACEHOLDER, this.active_file.filename.replace(/#$/,'')); // remove # if it is the last character, this is not part of the filename and just an anchor
this.initializeSocketForRunning(url);
}.bind(this));
}
event.preventDefault();
if ($('#run').is(':visible')) {
this.createSubmission('#run', null, this.runSubmission.bind(this));
}
},
runSubmission: function (submission) {
//Run part starts here
$('#stop').data('url', submission.stop_url);
this.running = true;
this.showSpinner($('#run'));
$('#score_div').addClass('hidden');
this.toggleButtonStates();
var url = submission.run_url.replace(this.FILENAME_URL_PLACEHOLDER, this.active_file.filename.replace(/#$/,'')); // remove # if it is the last character, this is not part of the filename and just an anchor
this.initializeSocketForRunning(url);
},
saveCode: function(event) {