diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index d5522b898..bc60fc027 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -3,7 +3,7 @@ class GamesController < ApplicationController layout "base_myshixun" skip_before_filter :verify_authenticity_token, :only => [:file_update] before_filter :find_myshixun, :only => [:index] - before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :prev_step,:outputs_show, :file_edit, :file_update, :get_waiting_time, + before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :prev_step,:outputs_show, :file_edit, :file_update, :get_waiting_time, :web_display, :game_status, :change_status, :answer, :minus_score, :refresh_game_list, :reset_original_code, :reset_new_code, :evaluating_choice, :sync_codes] before_filter :find_repository, :only => [:show, :entry, :file_edit, :file_update, :reset_original_code, :reset_new_code, :html_show] before_filter :allowd_manager @@ -496,6 +496,20 @@ class GamesController < ApplicationController end end + # web渲染 + def web_display + path = @game.challenge.path.strip + port = (50000 + @game.myshixun_id).to_s + # 测试 + #path = "src/step1/Helloworld.php" + #port = (50000+4116).to_s + @url = "http://106.75.96.108:" + port + '/' + path + + respond_to do |format| + format.html{render :layout => false} + end + end + def minus_score @game_challenge = @game.challenge user = User.current diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index a2aadf706..fad907f1c 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -118,6 +118,7 @@ class MyshixunsController < ApplicationController # resubmit 1:表示已通关后重新评测;0:表示非重新评测 # retry_status 0:初始值;1:重新评测失败;2:重新评测成功 def training_task_status + #params[:jsonTestDetails] = '{"buildID":"1","compileSuccess":"1","msg":[{"caseId":"1","expectedOutput":"56ysMOS9jeWQjOWtpueahOaAu+WIhuS4ujoyNDcK56ysMeS9jeWQjOWtpueahOaAu+WIhuS4ujoz MjIK","input":"Mg0KMjMsNTYsNzgsOTANCjIxLDU2LDc4LDc2LDkx","output":"56ysMOS9jeWQjOWtpueahOaAu+WIhuS4ujoyNDcK56ysMeS9jeWQjOWtpueahOaAu+WIhuS4ujoz MjIK","passed":"1"},{"caseId":"2","expectedOutput":"56ysMOS9jeWQjOWtpueahOaAu+WIhuS4ujoyMjgK56ysMeS9jeWQjOWtpueahOaAu+WIhuS4ujoy MzUK56ysMuS9jeWQjOWtpueahOaAu+WIhuS4ujoyMDYK","input":"Mw0KOTgsNzYsNTQNCjkwLDU0LDg3LDQNCjc4LDI2LDEyLDkw","output":"56ysMOS9jeWQjOWtpueahOaAu+WIhuS4ujoyMjgK56ysMeS9jeWQjOWtpueahOaAu+WIhuS4ujoy MzUK56ysMuS9jeWQjOWtpueahOaAu+WIhuS4ujoyMDYK","passed":"1"}],"outPut":"Y29tcGlsZSBzdWNjZXNzZnVsbHk","resubmit":"57D9COBR_5806","status":"0"}' jsonTestDetails = JSON.parse(params[:jsonTestDetails]) status = jsonTestDetails['status'] game_id = jsonTestDetails['buildID'] @@ -131,7 +132,9 @@ class MyshixunsController < ApplicationController challenge = game.challenge unless jenkins_testsets.blank? jenkins_testsets.each do |j_test_set| + logger.info("j_test_set: ############## #{j_test_set['output']}") actual_output = tran_base64_decode64(j_test_set['output']) + logger.info "actual_output:################################################# #{actual_output}" game_outputs = Output.create(:code => status, :game_id => game_id, :out_put => outPut, :test_set_position => j_test_set['caseId'], :actual_output => actual_output, :result => j_test_set['passed'].to_i, :query_index => game.query_index, :compile_success => compile_success.to_i) # output = Output.where(:game_id => game.id, :test_set_position => j_test_set['caseId'].to_i).first diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 311530b80..b5b272889 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -4845,7 +4845,7 @@ def get_hw_index(hw,is_teacher,type=0) end end hw_ids = homeworks.map{|hw| hw.id} if !homeworks.blank? - index = hw_ids.index(hw.id) + index = hw_ids.length - 1 - hw_ids.index(hw.id) return index end diff --git a/app/models/memo.rb b/app/models/memo.rb index 1eb8f29aa..dc12fe367 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -11,7 +11,7 @@ class Memo < ActiveRecord::Base # 若是主题帖,则内容可以是空 #validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? } validates_length_of :subject, maximum: 50 - validates_length_of :content, maximum: 30000 + validate :cannot_reply_to_locked_topic, :on => :create diff --git a/app/views/courses/settings/_all_student_list.html.erb b/app/views/courses/settings/_all_student_list.html.erb index ad54ce938..c0be48c37 100644 --- a/app/views/courses/settings/_all_student_list.html.erb +++ b/app/views/courses/settings/_all_student_list.html.erb @@ -9,14 +9,14 @@ <% if @no_group_count > 0 %>
未分班<%= @no_group_count %>
+未分班<%= @no_group_count %>
- <%= group.name %> + <%= group.name %> <%= group.members.count %>
@@ -31,7 +31,7 @@ \ No newline at end of file diff --git a/app/views/shixuns/index.html.erb b/app/views/shixuns/index.html.erb index cee2e50e1..21ba7e96f 100644 --- a/app/views/shixuns/index.html.erb +++ b/app/views/shixuns/index.html.erb @@ -94,6 +94,14 @@