Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_forum
cxt 6 years ago
commit e60d6f7abb

@ -45,7 +45,7 @@ class CommonsController < ApplicationController
code =
case params[:object_type].strip
when 'message'
if current_user.course_identity(@object.board.course) >= 5 || @object.author != current_user
if current_user.course_identity(@object.board.course) >= 5 && @object.author != current_user
403
else
200
@ -53,7 +53,7 @@ class CommonsController < ApplicationController
else
current_user.admin? ? 200 : 403
end
return normal_status(403, "你没有权限操作!") if code == 403
return normal_status(code, "你没有权限操作!") if code == 403
end
def action(flag)

@ -733,14 +733,14 @@ class ShixunsController < ApplicationController
private
def shixun_params
raise("实训名称不能为空") if params[:name].blank?
raise("实训名称不能为空") if params[:shixun][:name].blank?
params.require(:shixun).permit(:name, :trainee, :webssh, :can_copy, :use_scope, :vnc, :test_set_permission,
:task_pass, :repo_name, :multi_webssh, :opening_time, :mirror_script_id, :code_hidden,
:hide_code, :forbid_copy)
end
def shixun_info_params
raise("实训描述不能为空") if params[:description].blank?
raise("评测脚本不能为空") if params[:evaluate_script].blank?
raise("实训描述不能为空") if params[:shixun_info][:description].blank?
raise("评测脚本不能为空") if params[:shixun_info][:evaluate_script].blank?
params.require(:shixun_info).permit(:description, :evaluate_script)
end

@ -52,7 +52,7 @@ class Challenge < ApplicationRecord
# 开启挑战
def open_game user_id, shixun
game = self.games.first
game = self.games.where(user_id: user_id).first
if game.present?
shixun.task_pass || game.status != 3 ? "/tasks/#{game.identifier}" : ""
else

@ -41,7 +41,7 @@ class ExerciseUserPdfService
# #-----正式需删掉
# aa = File.open(Rails.root.join("public/123.html"),"w+")
# aa.syswrite(kit.source)
# #正式需删掉-------
# #正式需删掉-------s
file = Tempfile.new(filename)
kit.to_pdf(file.path)
file

@ -94,7 +94,7 @@
<% elsif q.question_type == 2 %>
<div class="pbt5 clearfix">
<% q.exercise_choices.each do |s| %>
<span class="mr15 clearfix">
<span class="mr15">
<span class="choose-radio "></span>
<span class="mlr5 inline-block"><%= s.choice_text %></span>
</span>

@ -39,7 +39,10 @@ p{
margin-bottom: 10px;
}
.mt8{
margin-top:8px;
margin-top:7px;
}
.mt10{
margin-top:10px;
}
.mbt10{
margin: 10px 0;
@ -109,6 +112,9 @@ p{
white-space: normal;
min-height:12px;
}
.null-answer p{
display: inline-block;
}
.choose-radio{
display: inline-block;
width: 12px;
@ -322,6 +328,12 @@ textarea{
.choice-text p{
margin-bottom:0;
}
.mt-2{
margin-top:-2px;
}
.ex-scores{
height: auto ;
}

@ -37,14 +37,13 @@
共<span class="mlr5"><%= @exercise_ques_null_scores %></span>分</span>
<% end %>
<% if @exercise_ques_main_count > 0 %>
<span class="mr15">主观题<span class="mlr5"><%= @exercise_ques_main_count %></span>题,
共<span class="mlr5"><%= @exercise_ques_main_scores %></span>分</span>
<span class="mr15">主观题<span class="mlr5"><%= @exercise_ques_main_count %></span>题,
共<span class="mlr5"><%= @exercise_ques_main_scores %></span>分</span>
<% end %>
<% if @exercise_ques_shixun_count > 0 %>
<span class="mr15">实训题<span class="mlr5"><%= @exercise_ques_shixun_count %></span>题,
共<span class="mlr5"><%= @exercise_ques_shixun_scores %></span>分</span>
<span class="mr15">实训题<span class="mlr5"><%= @exercise_ques_shixun_count %></span>题,
共<span class="mlr5"><%= @exercise_ques_shixun_scores %></span>分</span>
<% end %>
<% if @exercise_ques_count > 0 %>
<span class="pull-right">
共<span class="text-orange mlr5"><%= @exercise_ques_scores %></span>分
@ -56,6 +55,7 @@
</p>
</div>
</div>
<div class="clearfix"></div>
<div class="mbt10">
<% if @ex_obj_array.size > 0 %>
<div>
@ -177,27 +177,30 @@
<% end %>
</div>
</div>
<div class="clearfix"></div>
<div class="pbt5">
<% if q_type == 0 %>
<% q.exercise_choices.each do |s| %>
<% check_answer = (user_answer.present? && (s.id == user_answer.first.exercise_choice_id)) ? "choose-answer" : '' %>
<div class="pbt5 clearfix main-choice">
<span class="choose-radio <%= check_answer %> pull-left mt8"></span>
<span class="inline-block pull-left ml10 choice-text"><%= to_markdown(s.choice_text,@request_url) %></span>
<div class="pbt10 clearfix main-choice">
<span class="choose-radio <%= check_answer %> pull-left mt10"></span>
<span class="inline-block pull-left ml10 choice-text mt-2"><%= to_markdown(s.choice_text,@request_url) %></span>
</div>
<% end %>
<div class="clearfix"></div>
<% elsif q_type == 1 %>
<% q.exercise_choices.each do |s| %>
<% check_answer = (user_answer.present? && (user_answer.pluck(:exercise_choice_id).include?(s.id))) ? true : false %>
<div class="pbt5 clearfix main-choice">
<div class="pbt10 clearfix main-choice">
<% if check_answer %>
<span class="choose-checkbox choose-answer-multi mt8" ></span>
<span class="choose-checkbox choose-answer-multi mt10 pull-left" ></span>
<% else %>
<span class="choose-checkbox pull-left mt8"></span>
<span class="choose-checkbox pull-left mt10"></span>
<% end %>
<span class="inline-block pull-left choice-text ml10"><%= to_markdown(s.choice_text,@request_url) %></span>
<span class="inline-block pull-left choice-text ml10 mt-2"><%= to_markdown(s.choice_text,@request_url) %></span>
</div>
<% end %>
<div class="clearfix"></div>
<% elsif q_type == 2 %>
<div class="pbt5 clearfix">
<% q.exercise_choices.each do |s| %>
@ -212,6 +215,7 @@
</span>
<% end %>
</div>
<div class="clearfix"></div>
<% elsif q_type == 3 %>
<% st_counts = q.exercise_standard_answers.pluck(:exercise_choice_id).uniq %>
<% st_counts.each_with_index do |s,index| %>
@ -220,16 +224,20 @@
<% else %>
<% check_answer = "--" %>
<% end %>
<p class="pbt10 flex-nowrap">
<div class="pbt10 flex-nowrap clearfix">
<span class="pull-left line-34">答案(填空<%= index+1 %></span>
<span class="null-answer"><%= to_markdown(check_answer) %></span>
</p>
<span class="null-answer pull-left"><%= to_markdown(check_answer,@request_url) %></span>
</div>
<div class="clearfix"></div>
<% end %>
<% elsif q_type == 4 %>
<% check_answer = (user_answer.present? ? user_answer.first.answer_text : '--') %>
<p class="flex-nowrap">
<span class="null-answer main-height"><%= to_markdown(check_answer) %></span>
</p>
<div class="flex-nowrap">
<div class="null-answer main-height">
<%= to_markdown(check_answer,@request_url) %>
</div>
</div>
<div class="clearfix"></div>
<% else %>
<div class="mbt10">
<p class="text-gray mbt10">
@ -326,6 +334,7 @@
</div>
<% end %>
</div>
<div class="clearfix"></div>
<% end %>
</div>
</div>

Loading…
Cancel
Save