This commit is contained in:
John Geiger
2016-06-08 13:54:39 +02:00
5 changed files with 20 additions and 5 deletions

View File

@@ -174,8 +174,14 @@ class SubmissionsController < ApplicationController
def parse_message(message, output_stream, socket, recursive = true)
begin
parsed = JSON.parse(message)
socket.send_data message
Rails.logger.info('parse_message sent: ' + message)
if(parsed.class == Hash && parsed.key?('cmd'))
socket.send_data message
Rails.logger.info('parse_message sent: ' + message)
else
parsed = {'cmd'=>'write','stream'=>output_stream,'data'=>message}
socket.send_data JSON.dump(parsed)
Rails.logger.info('parse_message sent: ' + JSON.dump(parsed))
end
rescue JSON::ParserError => e
# Check wether the message contains multiple lines, if true try to parse each line
if ((recursive == true) && (message.include? "\n"))

View File

@@ -27,7 +27,7 @@ h1 = Exercise.model_name.human(count: 2)
- @exercises.each do |exercise|
tr data-id=exercise.id
td = exercise.title
td = link_to_if(policy(exercise.author).show?, exercise.author, exercise.author)
td = link_to_if(exercise.author && policy(exercise.author).show?, exercise.author, exercise.author)
td = link_to_if(exercise.execution_environment && policy(exercise.execution_environment).show?, exercise.execution_environment, exercise.execution_environment)
td = exercise.files.teacher_defined_tests.count
td = exercise.maximum_score

View File

@@ -12,7 +12,7 @@
limit 1").first['id'].to_i
submission = Submission.find(submission_id)
%>
<%= user %> | <%= @request_for_comment.requested_at %>
<%= user.displayname %> | <%= @request_for_comment.requested_at %>
</p>
<h5>
<% if @request_for_comment.question and not @request_for_comment.question == '' %>