From d6fe9939f603d95a4dcb2f5632f084318380e594 Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 31 Jul 2015 16:59:30 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E8=80=81=E5=B8=88=E6=B5=8B=E8=AF=95?=
=?UTF-8?q?=E4=BB=A3=E7=A0=81base64=E5=8A=A0=E5=AF=86=EF=BC=8C=20=E8=BF=94?=
=?UTF-8?q?=E5=9B=9E=E5=80=BCjson=E5=8F=96=E5=80=BC=E6=9C=89=E9=97=AE?=
=?UTF-8?q?=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/homework_common_controller.rb | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index f48633a53..e3424707f 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -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
From 346f4d60187663ec064a7d7509205983210c37ef Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 31 Jul 2015 17:27:43 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E7=95=8C=E9=9D=A2=EF=BC=8C=E5=AD=A6=E7=94=9F=E4=B8=8D=E6=98=BE?=
=?UTF-8?q?=E7=A4=BA=E8=BE=93=E5=85=A5=E8=BE=93=E5=87=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/homework_common/index.html.erb | 38 +++++++++++++-----------
app/views/student_work/index.html.erb | 36 +++++++++++-----------
2 files changed, 39 insertions(+), 35 deletions(-)
diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb
index 6847da2c7..4a804ae60 100644
--- a/app/views/homework_common/index.html.erb
+++ b/app/views/homework_common/index.html.erb
@@ -48,30 +48,32 @@
- <% if homework.homework_type == 2 && homework.homework_detail_programing && @is_teacher%>
-
-
- ">
-
- 输入
- |
-
- 输出
- |
-
- <% homework.homework_tests.each do |test|%>
+ <% if homework.homework_type == 2 && homework.homework_detail_programing%>
+ <% if @is_teacher%>
+
+
">
- <%=test.input%>
+ 输入
|
- <%= test.output%>
+ 输出
|
- <% end%>
-
-
-
+ <% homework.homework_tests.each do |test|%>
+ ">
+
+ <%=test.input%>
+ |
+
+ <%= test.output%>
+ |
+
+ <% end%>
+
+
+
+ <% end%>
开发语言:
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index 92f6f93e0..3783d67d3 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -137,29 +137,31 @@
<% if @homework.homework_type == 2 && @homework.homework_detail_programing%>
-
-
- ">
-
- 输入
- |
-
- 输出
- |
-
- <% @homework.homework_tests.each do |test|%>
+ <% if @is_teacher%>
+
+
">
- <%=test.input%>
+ 输入
|
- <%= test.output%>
+ 输出
|
- <% end%>
-
-
-
+ <% homework.homework_tests.each do |test|%>
+ ">
+
+ <%=test.input%>
+ |
+
+ <%= test.output%>
+ |
+
+ <% end%>
+
+
+
+ <% end%>
开发语言: