parent
782f7b074e
commit
d6fe9939f6
|
@ -1,6 +1,7 @@
|
|||
class HomeworkCommonController < ApplicationController
|
||||
require 'net/http'
|
||||
require 'json'
|
||||
require "base64"
|
||||
layout "base_courses"
|
||||
before_filter :find_course, :only => [:index,:new,:create,:next_step]
|
||||
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy]
|
||||
|
@ -353,7 +354,7 @@ class HomeworkCommonController < ApplicationController
|
|||
end
|
||||
|
||||
def programing_test
|
||||
test = {language:params[:language],src:params[:src],input:[params[:input]],output:[params[:output]]}
|
||||
test = {language:params[:language],src:Base64.encode64(params[:src]),input:[params[:input]],output:[params[:output]]}
|
||||
@index = params[:index]
|
||||
uri = URI('http://192.168.80.21:8080/api/realtime.json')
|
||||
body = test.to_json
|
||||
|
@ -364,8 +365,8 @@ class HomeworkCommonController < ApplicationController
|
|||
client.request(request)
|
||||
end
|
||||
result = JSON.parse(res.body)
|
||||
result[:results].each do |re|
|
||||
@result = re[:status]
|
||||
result["results"].each do |re|
|
||||
@result = re["status"]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue