Merge remote-tracking branch 'origin/master' into statistics

This commit is contained in:
Maximilian Grundke
2015-11-03 16:13:39 +01:00
5 changed files with 28 additions and 14 deletions

View File

@ -1127,6 +1127,10 @@ $(function() {
var initTurtle = function() {
// todo guard clause if turtle is not required for the current exercise
// clear canvas
// turtlecanvas.getContext("2d").clearRect(0, 0, turtlecanvas.width, turtlecanvas.height);
turtlescreen = new Turtle(websocket, turtlecanvas);
if ($('#run').isPresent()) {
$('#run').bind('click', hideCanvas);

View File

@ -112,13 +112,13 @@ class SubmissionsController < ApplicationController
end
tubesock.onmessage do |data|
Rails.logger.info("Client sending: " + data)
Rails.logger.debug("Client sending: " + data)
# Check wether the client send a JSON command and kill container
# if the command is 'exit', send it to docker otherwise.
begin
parsed = JSON.parse(data)
if parsed['cmd'] == 'exit'
Rails.logger.info("Client exited container.")
Rails.logger.debug("Client exited container.")
@docker_client.exit_container(result[:container])
else
socket.send data
@ -209,6 +209,7 @@ class SubmissionsController < ApplicationController
end
def stop
Rails.logger.debug('stopping submission ' + @submission)
container = Docker::Container.get(params[:container_id])
DockerClient.destroy_container(container)
rescue Docker::Error::NotFoundError