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

dev_course
cxt 5 years ago
commit ea2de283d9

1
.gitignore vendored

@ -47,6 +47,7 @@
public/upload.html public/upload.html
/config/configuration.yml /config/configuration.yml
/config/environments/production.rb
/config/initializers/gitlab_config.rb /config/initializers/gitlab_config.rb
/db/schema.rb /db/schema.rb
.vscode/ .vscode/

@ -45,12 +45,12 @@ gem 'rqrcode_png'
gem 'acts-as-taggable-on', '~> 6.0' gem 'acts-as-taggable-on', '~> 6.0'
group :development, :test do group :'development.rb.example', :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'rspec-rails', '~> 3.8' gem 'rspec-rails', '~> 3.8'
end end
group :development do group :'development.rb.example' do
gem 'awesome_print' gem 'awesome_print'
gem 'web-console', '>= 3.3.0' gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2' gem 'listen', '>= 3.0.5', '< 3.2'

@ -126,6 +126,13 @@ class ApplicationController < ActionController::Base
end end
end end
# 课堂教师、课堂管理员、超级管理员的权限(不包含助教)
def teacher_or_admin_allowed
unless current_user.course_identity(@course) < Course::ASSISTANT_PROFESSOR
normal_status(403, "")
end
end
def require_admin def require_admin
normal_status(403, "") unless User.current.admin? normal_status(403, "") unless User.current.admin?
end end
@ -176,19 +183,20 @@ class ApplicationController < ActionController::Base
# 系统全局认证 # 系统全局认证
# #
def check_auth def check_auth
old_edu_host = edu_setting('old_edu_host') # old_edu_host = edu_setting('old_edu_host')
ue = current_user.user_extension # ue = current_user.user_extension
#
if current_user.lastname.blank? || ue.school_id.blank? || ue.identity.blank? || current_user.mail.blank? # if current_user.lastname.blank? || ue.school_id.blank? || ue.identity.blank? || current_user.mail.blank?
info_url = old_edu_host + '/account/user_info' # info_url = old_edu_host + '/account/user_info'
render :json => { status: 402, url: info_url } # render :json => { status: 402, url: info_url }
elsif current_user.certification != 1 # elsif current_user.certification != 1
day_cer = UserDayCertification.where(user_id: current_user.id).last # day_cer = UserDayCertification.where(user_id: current_user.id).last
unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 # unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400
account_url = old_edu_host + "/my/account" # account_url = old_edu_host + "/my/account"
render :json => { status: 402, url: account_url } # render :json => { status: 402, url: account_url }
end # end
end # end
true
end end
# 身份资料的认证: # 身份资料的认证:

@ -2,7 +2,7 @@ class CourseGroupsController < ApplicationController
before_action :require_login before_action :require_login
before_action :set_group, except: [:create] before_action :set_group, except: [:create]
before_action :find_course, only: [:create] before_action :find_course, only: [:create]
before_action :teacher_allowed before_action :teacher_or_admin_allowed
def create def create
tip_exception("分班名称不能为空") if params[:name].blank? tip_exception("分班名称不能为空") if params[:name].blank?

@ -25,11 +25,11 @@ class CoursesController < ApplicationController
before_action :teacher_allowed, only: [:update, :destroy, :settings, :search_teacher_candidate, before_action :teacher_allowed, only: [:update, :destroy, :settings, :search_teacher_candidate,
:transfer_to_course_group, :delete_from_course, :transfer_to_course_group, :delete_from_course,
:search_users, :add_students_by_search, :get_historical_courses, :add_teacher_popup, :add_teacher] :search_users, :add_students_by_search, :get_historical_courses, :add_teacher_popup, :add_teacher]
before_action :admin_allowed, only: [:set_invite_code_halt, :set_public_or_private, :join_graduation_group, before_action :admin_allowed, only: [:set_invite_code_halt, :set_public_or_private, :change_course_admin,
:set_course_group, :change_course_admin, :change_course_teacher, :set_course_group, :delete_course_teacher, :teacher_application_review,
:delete_course_teacher, :teacher_application_review, :create_group_by_importing_file] :create_group_by_importing_file]
before_action :teacher_or_admin_allowed, only: [:graduation_group_list, :create_graduation_group, :join_graduation_group, before_action :teacher_or_admin_allowed, only: [:graduation_group_list, :create_graduation_group, :join_graduation_group,
:export_member_scores_excel, :course_group_list] :change_course_teacher, :export_member_scores_excel, :course_group_list]
before_action :validate_course_name, only: [:create, :update] before_action :validate_course_name, only: [:create, :update]
before_action :find_board, only: :board_list before_action :find_board, only: :board_list
before_action :validate_page_size, only: :mine before_action :validate_page_size, only: :mine

@ -480,7 +480,7 @@ class ExerciseQuestionsController < ApplicationController
ex_answers = @exercise_question.exercise_answers.search_answer_users("user_id",@user_id) #当前用户答案的得分 ex_answers = @exercise_question.exercise_answers.search_answer_users("user_id",@user_id) #当前用户答案的得分
if @exercise_question.question_type == 3 #当为填空题,更新问题的总分, if @exercise_question.question_type == 3 #当为填空题,更新问题的总分,
ex_answer_old = ex_answers.score_reviewed.pluck(:score).sum #每一关的得分总和 ex_answer_old = ex_answers.score_reviewed.pluck(:score).sum #每一关的得分总和
each_right_score = (@c_score / ex_answers.count.to_f).round(1) #调分后,平均每关的分数 each_right_score = (@c_score / ex_answers.count.to_f) #调分后,平均每关的分数
new_obj_score = ex_obj_score - ex_answer_old + @c_score new_obj_score = ex_obj_score - ex_answer_old + @c_score
total_scores = new_obj_score + ex_subj_score total_scores = new_obj_score + ex_subj_score
ex_scores = { ex_scores = {
@ -615,7 +615,7 @@ class ExerciseQuestionsController < ApplicationController
normal_status(-1,"题目不允许为空!") if (params[:question_title].blank? && params[:question_type].to_i !=5 ) #除了实训题,其余题目必需有题干 normal_status(-1,"题目不允许为空!") if (params[:question_title].blank? && params[:question_type].to_i !=5 ) #除了实训题,其余题目必需有题干
normal_status(-1,"问题类型不允许为空!" ) if params[:question_type].blank? normal_status(-1,"问题类型不允许为空!" ) if params[:question_type].blank?
normal_status(-1,"分值不允许为空!" ) if params[:question_score].blank? && params[:question_scores].blank? #分值的数组或参数必需存在一个 normal_status(-1,"分值不允许为空!" ) if params[:question_score].blank? && params[:question_scores].blank? #分值的数组或参数必需存在一个
if params[:question_score].present? && params[:question_score].to_f.round(1) <= 0.0 #问题类型存在,则分值不能为空,且必需大于0 if params[:question_score].present? && params[:question_score].to_f <= 0.0 #问题类型存在,则分值不能为空,且必需大于0
normal_status(-1,"分值必需大于0") normal_status(-1,"分值必需大于0")
elsif (params[:question_score].present? && params[:question_score].to_f.round(1) > 100.0) || (params[:question_scores].present? && (params[:question_scores].map{|a| a.to_f.round(1)}.max > 100.0)) elsif (params[:question_score].present? && params[:question_score].to_f.round(1) > 100.0) || (params[:question_scores].present? && (params[:question_scores].map{|a| a.to_f.round(1)}.max > 100.0))
normal_status(-1,"分值不能超过100分") normal_status(-1,"分值不能超过100分")
@ -677,7 +677,7 @@ class ExerciseQuestionsController < ApplicationController
end end
def check_adjust_score def check_adjust_score
@c_score = params[:score].to_f.round(1) #调分后的分数 @c_score = params[:score].to_f #调分后的分数
@user_id = params[:user_id] @user_id = params[:user_id]
@exercise_current_user = @exercise.exercise_users.exercise_commit_users(@user_id).first #当前试卷用户的答案内容 @exercise_current_user = @exercise.exercise_users.exercise_commit_users(@user_id).first #当前试卷用户的答案内容
if @exercise_current_user.blank? if @exercise_current_user.blank?

@ -62,6 +62,22 @@ class GamesController < ApplicationController
praise_count: praise_count, user_praise: user_praise, time_limit: time_limit, praise_count: praise_count, user_praise: user_praise, time_limit: time_limit,
tomcat_url: edu_setting('cloud_tomcat_php'), is_teacher: is_teacher, tomcat_url: edu_setting('cloud_tomcat_php'), is_teacher: is_teacher,
myshixun_manager: myshixun_manager} myshixun_manager: myshixun_manager}
if @shixun.vnc
begin
shixun_tomcat = edu_setting('shixun_tomcat')
service_host = edu_setting('vnc_url')
uri = "#{shixun_tomcat}/bridge/vnc/getvnc"
params = {tpiID: @myshixun.id, :containers => "#{Base64.urlsafe_encode64(container_limit(@shixun.mirror_repositories))}"}
res = uri_post uri, params
if res && res['code'].to_i != 0
raise("实训云平台繁忙繁忙等级99")
end
@url = "http://#{service_host}:#{res['port']}}/vnc_lite.html?password=headless"
Rails.logger.info("66666666sssssss#{url}")
rescue Exception => e
Rails.logger.error(e.message)
end
end
# 区分选择题和编程题st0编程题 # 区分选择题和编程题st0编程题
if @st == 0 if @st == 0

@ -200,10 +200,15 @@ class HomeworkCommonsController < ApplicationController
if @user_course_identity >= Course::STUDENT if @user_course_identity >= Course::STUDENT
tip_exception(403, "无权限操作") tip_exception(403, "无权限操作")
else else
student_work_to_xlsx(@work_excel,@homework) if @work_excel.present?
exercise_export_name = current_user.real_name + "_" + @course.name + "_" + @homework.name + "_" + Time.now.strftime('%Y%m%d_%H%M%S') student_work_to_xlsx(@work_excel,@homework)
render xlsx: "#{exercise_export_name.strip.first(30)}",template: "homework_commons/works_list.xlsx.axlsx",locals: exercise_export_name = current_user.real_name + "_" + @course.name + "_" + @homework.name + "_" + Time.now.strftime('%Y%m%d_%H%M%S')
{table_columns: @work_head_cells,task_users: @work_cells_column} render xlsx: "#{exercise_export_name.strip.first(30)}",template: "homework_commons/works_list.xlsx.axlsx",locals:
{table_columns: @work_head_cells,task_users: @work_cells_column}
else
normal_status(-1,"暂无提交的学生!")
end
end end
} }
format.zip{ format.zip{

@ -1,7 +1,7 @@
class MyshixunsController < ApplicationController class MyshixunsController < ApplicationController
before_action :require_login, :except => [:training_task_status, :code_runinng_message] before_action :require_login, :except => [:training_task_status, :code_runinng_message]
before_action :find_myshixun, :except => [:training_task_status] before_action :find_myshixun, :except => [:training_task_status, :code_runinng_message]
before_action :find_repo_name, :except => [:training_task_status] before_action :find_repo_name, :except => [:training_task_status, :code_runinng_message]
skip_before_action :verify_authenticity_token, :only => [:html_content] skip_before_action :verify_authenticity_token, :only => [:html_content]
## TPI关卡列表 ## TPI关卡列表

@ -1,5 +1,5 @@
class ShixunsController < ApplicationController class ShixunsController < ApplicationController
# before_action :require_login, except: [:download_file, :index, :menus] before_action :require_login, except: [:download_file, :index, :menus]
before_action :check_auth, except: [:download_file, :index] before_action :check_auth, except: [:download_file, :index]
before_action :find_shixun, except: [:index, :new, :create, :menus, :get_recommend_shixuns, :propaedeutics, before_action :find_shixun, except: [:index, :new, :create, :menus, :get_recommend_shixuns, :propaedeutics,
@ -492,6 +492,7 @@ class ShixunsController < ApplicationController
if current_myshixun if current_myshixun
# 如果TPM和TPI的管卡数不相等或者关卡顺序错了说明实训被极大的改动需要重置 # 如果TPM和TPI的管卡数不相等或者关卡顺序错了说明实训被极大的改动需要重置
uid_logger_error("7777777777777777#{current_myshixun.games.count}, #{@shixun.challenges_count}")
if current_myshixun.games.count != @shixun.challenges_count || current_myshixun.games.map(&:challenge_id).sort != Challenge.where(shixun_id: @shixun.id).pluck(:id).sort if current_myshixun.games.count != @shixun.challenges_count || current_myshixun.games.map(&:challenge_id).sort != Challenge.where(shixun_id: @shixun.id).pluck(:id).sort
# 这里页面弹框要收到 当前用户myshixun的identifier. # 这里页面弹框要收到 当前用户myshixun的identifier.
tip_show_exception("/myshixuns/#{current_myshixun.try(:identifier)}/reset_my_game") tip_show_exception("/myshixuns/#{current_myshixun.try(:identifier)}/reset_my_game")

@ -21,6 +21,7 @@ class ZipsController < ApplicationController
file_name = filename_for_content_disposition(exercises.filename) file_name = filename_for_content_disposition(exercises.filename)
send_file exercises.ex_zip, filename: file_name, type: 'application/zip' send_file exercises.ex_zip, filename: file_name, type: 'application/zip'
rescue Exception => e rescue Exception => e
normal_status(-1, e.message) normal_status(-1, e.message)
end end
@ -39,7 +40,7 @@ class ZipsController < ApplicationController
def get_exercise def get_exercise
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
begin begin
@exercise = Exercise.find_by(id:params[:exercise_id]) @exercise = Exercise.includes(:exercise_users,:exercise_questions).find_by(id:params[:exercise_id])
group_id = params[:exercise_group_id] group_id = params[:exercise_group_id]
if @exercise.blank? if @exercise.blank?
normal_status(-1,"试卷不存在") normal_status(-1,"试卷不存在")

@ -14,12 +14,14 @@ module UserDecorator
# 关注数 # 关注数
def follow_count def follow_count
User.watched_by(id).count Watcher.where(user_id: id, watchable_type: %w(Principal User)).count
# User.watched_by(id).count
end end
# 粉丝数 # 粉丝数
def fan_count def fan_count
watchers.count Watcher.where(watchable_type: %w(Principal User), watchable_id: id).count
# watchers.count
end end
# 是否绑定邮箱 # 是否绑定邮箱

@ -246,15 +246,18 @@ module CoursesHelper
def left_group_info course def left_group_info course
group_info = [] group_info = []
course.course_groups.each do |course_group| if course.course_groups_count > 0
group_info << {category_id: course_group.id, category_name: course_group.name, position: course_group.position, course.course_groups.each do |course_group|
category_count: course_group.course_members_count, category_type: false, group_info << {category_id: course_group.id, category_name: course_group.name, position: course_group.position,
second_category_url: "/courses/#{@course.id}/course_groups/#{course_group.id}"} category_count: course_group.course_members_count, category_type: false,
second_category_url: "/courses/#{@course.id}/course_groups/#{course_group.id}"}
end
none_group_count = course.students.where(course_group_id: 0).size
group_info << {category_id: 0, category_name: "未分班", position: course.course_groups.pluck(:position).max.to_i + 1,
category_count: none_group_count, category_type: false,
second_category_url: "/courses/#{@course.id}/course_groups/0"}
end end
none_group_count = course.students.where(course_group_id: 0).size group_info
group_info << {category_id: 0, category_name: "未分班", position: course.course_groups.pluck(:position).max.to_i + 1,
category_count: none_group_count, category_type: false,
second_category_url: "/courses/#{@course.id}/course_groups/0"}
end end
end end

@ -245,7 +245,7 @@ module ExportHelper
else else
user_course = "--" user_course = "--"
end end
user_obj_score = e_user.objective_score < 0.0 ? 0.0 : e_user.subjective_score.round(1).to_s user_obj_score = e_user.objective_score < 0.0 ? 0.0 : e_user.objective_score.round(1).to_s
user_suj_score = e_user.subjective_score < 0.0 ? 0.0 : e_user.subjective_score.round(1).to_s user_suj_score = e_user.subjective_score < 0.0 ? 0.0 : e_user.subjective_score.round(1).to_s
user_score = e_user.score.present? ? e_user.score.round(1).to_s : 0.0 user_score = e_user.score.present? ? e_user.score.round(1).to_s : 0.0
if e_user.commit_status.present? && e_user.commit_status == 1 if e_user.commit_status.present? && e_user.commit_status == 1

@ -260,7 +260,7 @@ class User < ApplicationRecord
# 实训管理员实训合作者、admin # 实训管理员实训合作者、admin
def manager_of_shixun?(shixun) def manager_of_shixun?(shixun)
shixun.shixun_members.exists?(role: [1,2], user_id: id) || admin? shixun.shixun_members.exists?(role: [1,2], user_id: id) || admin? || business?
end end
# 实训管理员 # 实训管理员

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

@ -13,13 +13,13 @@
</div> </div>
<div class="plr15"> <div class="plr15">
<p class="text-gray"> <p class="text-gray">
<%= @exercise.try(:exercise_description).nil? ? "" : @exercise.try(:exercise_description).html_safe %> <%= @exercise.try(:exercise_description).nil? ? "" : @exercise.try(:exercise_description)&.html_safe %>
</p> </p>
</div> </div>
</div> </div>
<div class="mbt20 bgc"> <div class="mbt20 bgc">
<div class="ex-scores pd10 text-gray fs13"> <div class="ex-scores pd10 text-gray fs13">
<div class="inline-block pull-left"> <p class="clearfix">
<% if @exercise_single_ques_count > 0 %> <% if @exercise_single_ques_count > 0 %>
<span class="mr15">单选题<span class="mlr5"><%= @exercise_single_ques_count %></span>题, <span class="mr15">单选题<span class="mlr5"><%= @exercise_single_ques_count %></span>题,
共<span class="mlr5"><%= @exercise_single_ques_scores %></span>分</span> 共<span class="mlr5"><%= @exercise_single_ques_scores %></span>分</span>
@ -44,10 +44,16 @@
<span class="mr15">实训题<span class="mlr5"><%= @exercise_ques_shixun_count %></span>题, <span class="mr15">实训题<span class="mlr5"><%= @exercise_ques_shixun_count %></span>题,
共<span class="mlr5"><%= @exercise_ques_shixun_scores %></span>分</span> 共<span class="mlr5"><%= @exercise_ques_shixun_scores %></span>分</span>
<% end %> <% end %>
</div>
<div style="text-align:right;word-break:keep-all;">合计<span class="text-blue mlr5"><%= @exercise_ques_count %></span>题, <% if @exercise_ques_count > 0 %>
共<span class="text-orange mlr5"><%= @exercise_ques_scores %></span>分 <span class="pull-right">
</div> 共<span class="text-orange mlr5"><%= @exercise_ques_scores %></span>分
</span>
<span class="mr15 pull-right">
合计<span class="text-blue mlr5"><%= @exercise_ques_count %></span>题
</span>
<% end %>
</p>
</div> </div>
</div> </div>
<div class="mbt10"> <div class="mbt10">
@ -63,12 +69,12 @@
</div> </div>
<div class="pbt5"> <div class="pbt5">
<% if q.question_type == 5 %> <% if q.question_type == 5 %>
<span class="ques-title"><%= q.shixun_name.present? ? q.shixun_name.html_safe : "" %></span> <span class="ques-title"><%= q.shixun_name.present? ? q.shixun_name&.html_safe : "" %></span>
<div class="mt8 text-gray"> <div class="mt8 text-gray">
<span><%= q.question_title.present? ? q.question_title.html_safe : "" %></span> <span><%= q.question_title.present? ? q.question_title&.html_safe : "" %></span>
</div> </div>
<% else %> <% else %>
<span class="ques-title"><%= q.question_title.present? ? q.question_title.html_safe : "" %></span> <span class="ques-title"><%= q.question_title.present? ? q.question_title&.html_safe : "" %></span>
<% end %> <% end %>
</div> </div>
<div class="pbt5"> <div class="pbt5">

@ -1,5 +1,7 @@
body{ body{
font-size:14px;} font-size:14px;
font-family: "微软雅黑","宋体";
}
p{ p{
margin:0; margin:0;
} }
@ -229,7 +231,7 @@ p{
position: absolute; position: absolute;
display: inline-block; display: inline-block;
bottom: 9px; bottom: 9px;
left: 3px; left: 1px;
} }
.circle-right:after{ .circle-right:after{
color:#fff; color:#fff;
@ -303,6 +305,10 @@ textarea{
background-color:#eee; background-color:#eee;
line-height:2; line-height:2;
} }
.clearfix{
clear:both;
zoom:1;
}

@ -1,348 +1,353 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
</head> </head>
<body> <body>
<div class="container" style="background-color:#fff;"> <div class="container" style="background-color:#fff;">
<div> <div>
<div class="ex-title text-center mbt20"> <div class="ex-title text-center mbt20">
<div class="mbt10"> <div class="mbt10">
<h3><%= @exercise.try(:exercise_name) %></h3> <h3><%= @exercise.try(:exercise_name) %></h3>
</div> </div>
<div class="plr15"> <div class="plr15">
<p class="text-gray"> <p class="text-gray">
<%= @exercise.try(:exercise_description).nil? ? "" : @exercise.try(:exercise_description).html_safe %> <%= @exercise.try(:exercise_description).nil? ? "" : @exercise.try(:exercise_description)&.html_safe %>
</p> </p>
</div> </div>
</div> </div>
<div class="mbt20 bgc"> <div class="mbt20 bgc">
<div class="ex-scores pd10 text-gray fs13"> <div class="ex-scores pd10 text-gray fs13">
<div class="inline-block pull-left"> <p class="clearfix">
<% if @exercise_single_ques_count > 0 %> <% if @exercise_single_ques_count > 0 %>
<span class="mr15">单选题<span class="mlr5"><%= @exercise_single_ques_count %></span>题, <span class="mr15">单选题<span class="mlr5"><%= @exercise_single_ques_count %></span>题,
共<span class="mlr5"><%= @exercise_single_ques_scores %></span>分</span> 共<span class="mlr5"><%= @exercise_single_ques_scores %></span>分</span>
<% end %> <% end %>
<% if @exercise_double_ques_count > 0 %> <% if @exercise_double_ques_count > 0 %>
<span class="mr15">多选题<span class="mlr5"><%= @exercise_double_ques_count %></span>题, <span class="mr15">多选题<span class="mlr5"><%= @exercise_double_ques_count %></span>题,
共<span class="mlr5"><%= @exercise_double_ques_scores %></span>分</span> 共<span class="mlr5"><%= @exercise_double_ques_scores %></span>分</span>
<% end %> <% end %>
<% if @exercise_ques_judge_count > 0 %> <% if @exercise_ques_judge_count > 0 %>
<span class="mr15">判断题<span class="mlr5"><%= @exercise_ques_judge_count %></span>题, <span class="mr15">判断题<span class="mlr5"><%= @exercise_ques_judge_count %></span>题,
共<span class="mlr5"><%= @exercise_ques_judge_scores %></span>分</span> 共<span class="mlr5"><%= @exercise_ques_judge_scores %></span>分</span>
<% end %> <% end %>
<% if @exercise_ques_null_count > 0 %> <% if @exercise_ques_null_count > 0 %>
<span class="mr15">填空题<span class="mlr5"><%= @exercise_ques_null_count %></span>题, <span class="mr15">填空题<span class="mlr5"><%= @exercise_ques_null_count %></span>题,
共<span class="mlr5"><%= @exercise_ques_null_scores %></span>分</span> 共<span class="mlr5"><%= @exercise_ques_null_scores %></span>分</span>
<% end %> <% end %>
<% if @exercise_ques_main_count > 0 %> <% if @exercise_ques_main_count > 0 %>
<span class="mr15">主观题<span class="mlr5"><%= @exercise_ques_main_count %></span>题, <span class="mr15">主观题<span class="mlr5"><%= @exercise_ques_main_count %></span>题,
共<span class="mlr5"><%= @exercise_ques_main_scores %></span>分</span> 共<span class="mlr5"><%= @exercise_ques_main_scores %></span>分</span>
<% end %> <% end %>
<% if @exercise_ques_shixun_count > 0 %> <% if @exercise_ques_shixun_count > 0 %>
<span class="mr15">实训题<span class="mlr5"><%= @exercise_ques_shixun_count %></span>题, <span class="mr15">实训题<span class="mlr5"><%= @exercise_ques_shixun_count %></span>题,
共<span class="mlr5"><%= @exercise_ques_shixun_scores %></span>分</span> 共<span class="mlr5"><%= @exercise_ques_shixun_scores %></span>分</span>
<% end %> <% end %>
</div>
<div style="text-align:right;word-break:keep-all;"> <% if @exercise_ques_count > 0 %>
合计<span class="text-blue mlr5"><%= @exercise_ques_count %></span>题, <span class="pull-right">
共<span class="text-orange mlr5"><%= @exercise_ques_scores %></span>分 共<span class="text-orange mlr5"><%= @exercise_ques_scores %></span>分
</div> </span>
</div> <span class="mr15 pull-right">
</div> 合计<span class="text-blue mlr5"><%= @exercise_ques_count %></span>题
<div class="mbt10"> </span>
<% if @ex_obj_array.size > 0 %> <% end %>
<div> </p>
<p class="pbt10"> </div>
<span class="mr15">客观题</span> </div>
<span class="mlr5"><span class="line-line bg-green"></span>正确</span> <div class="mbt10">
<span class="mlr5"><span class="line-line bg-red"></span>错误</span> <% if @ex_obj_array.size > 0 %>
<span class="mlr5"><span class="line-line bg-orange"></span>部分得分</span> <div>
<span class="pull-right">总分:<span class="text-orange"><%= @exercise_user.score %>分</span></span> <p class="pbt10">
</p> <span class="mr15">客观题</span>
</div> <span class="mlr5"><span class="line-line bg-green"></span>正确</span>
<div class="pbt5"> <span class="mlr5"><span class="line-line bg-red"></span>错误</span>
<% @ex_obj_array.each do |s| %> <span class="mlr5"><span class="line-line bg-orange"></span>部分得分</span>
<% if s[:stand_status] == 1 %> <span class="pull-right">总分:<span class="text-orange"><%= @exercise_user&.score %>分</span></span>
<div class="inline-block right-status bg-green"> </p>
<span><%= s[:q_position] %></span> </div>
</div> <div class="pbt5">
<% elsif s[:stand_status] == 0 %> <% @ex_obj_array.each do |s| %>
<div class="inline-block right-status bg-red"> <% if s[:stand_status] == 1 %>
<span><%= s[:q_position] %></span> <div class="inline-block right-status bg-green">
</div> <span><%= s[:q_position] %></span>
<% else %> </div>
<div class="inline-block right-status bg-orange"> <% elsif s[:stand_status] == 0 %>
<span><%= s[:q_position] %></span> <div class="inline-block right-status bg-red">
</div> <span><%= s[:q_position] %></span>
<% end %> </div>
<% end %> <% else %>
</div> <div class="inline-block right-status bg-orange">
<% end %> <span><%= s[:q_position] %></span>
<% if @ex_sub_array.size > 0 %> </div>
<div> <% end %>
<p class="pbt10"> <% end %>
<span class="mr15">主观题</span> </div>
<span class="mlr5"><span class="circle-review bg-gray"></span>已评</span> <% end %>
<span class="mlr5"><span class="circle-review"></span>未评</span> <% if @ex_sub_array.size > 0 %>
<span class="pull-right text-gray">开始答题时间:<%= @exercise_user.start_at.present? ? @exercise_user.start_at.strftime("%Y-%m-%d %H:%M") : "--" %></span> <div>
</p> <p class="pbt10">
</div> <span class="mr15">主观题</span>
<div class="pbt5"> <span class="mlr5"><span class="circle-review bg-gray"></span>已评</span>
<% @ex_sub_array.each do |s| %> <span class="mlr5"><span class="circle-review"></span>未评</span>
<% if s[:stand_status] == 0 %> <span class="pull-right text-gray">开始答题时间:<%= @exercise_user.start_at.present? ? @exercise_user.start_at.strftime("%Y-%m-%d %H:%M") : "--" %></span>
<div class="inline-block right-status bd-radius"> </p>
<span class="text-gray"><%= s[:q_position] %></span> </div>
</div> <div class="pbt5">
<% else %> <% @ex_sub_array.each do |s| %>
<div class="inline-block right-status bg-gray"> <% if s[:stand_status] == 0 %>
<span><%= s[:q_position] %></span> <div class="inline-block right-status bd-radius">
</div> <span class="text-gray"><%= s[:q_position] %></span>
<% end %> </div>
<% end %> <% else %>
</div> <div class="inline-block right-status bg-gray">
<% end %> <span><%= s[:q_position] %></span>
</div> </div>
<div class="mbt10"> <% end %>
<% @exercise_questions.each do |q| %> <% end %>
<% q_type = q.question_type %> </div>
<% user_answer = (q_type == 5 ? q.exercise_shixun_answers.where(user_id: @ex_user_user.id) : q.exercise_answers.where(user_id: @ex_user_user.id)) %> <% end %>
<% this_ques_status = @ex_obj_array.detect{|f| f[:q_id] == q.id} %> </div>
<% main_ques_status = @ex_sub_array.detect{|f| f[:q_id] == q.id} %> <div class="mbt10">
<% ques_comment = q.exercise_answer_comments.where("exercise_answer_id",user_answer.first&.id) %> <% @exercise_questions.each do |q| %>
<div class="bdc"> <% q_type = q.question_type %>
<div class="pbt10"> <% user_answer = (q_type == 5 ? q.exercise_shixun_answers.where(user_id: @ex_user_user.id) : q.exercise_answers.where(user_id: @ex_user_user.id)) %>
<div class="position-relative"> <% this_ques_status = @ex_obj_array.detect{|f| f[:q_id] == q.id} %>
<div class="pbt5"> <% main_ques_status = @ex_sub_array.detect{|f| f[:q_id] == q.id} %>
<span class="mr5 text-blue"><%= q.question_number %>、&nbsp;</span> <% ques_comment = q.exercise_answer_comments.where("exercise_answer_id",user_answer.first&.id) %>
<span class="text-blue"> <div class="bdc">
<%= q.question_type_name %> <div class="pbt10">
</span> <div class="position-relative">
<span class="text-gray mlr5">(<%= q&.question_score %>分)</span> <div class="pbt5">
<% if q_type == 5 %> <span class="mr5 text-blue"><%= q.question_number %>、&nbsp;</span>
<span class="user-score"> <span class="text-blue">
<% if this_ques_status.present? && this_ques_status[:stand_status] == 1 %> <%= q.question_type_name %>
<span class="circle-score circle-right bg-green mr15"></span> </span>
<span class="text-green mr3"><%= this_ques_status[:user_score] %></span>分 <span class="text-gray mlr5">(<%= q&.question_score %>分)</span>
<% elsif this_ques_status.present? && this_ques_status[:stand_status] == 2 %> <% if q_type == 5 %>
<span class="circle-score circle-wrong bg-orange mr15"></span> <span class="user-score">
<span class="text-orange mr3"><%= this_ques_status[:user_score] %></span>分 <% if this_ques_status.present? && this_ques_status[:stand_status] == 1 %>
<% else %> <span class="circle-score circle-right bg-green mr15"></span>
<span class="circle-score circle-wrong bg-red mr15"></span> <span class="text-green mr3"><%= this_ques_status[:user_score] %></span>分
<span class="text-red mr3">0.0</span>分 <% elsif this_ques_status.present? && this_ques_status[:stand_status] == 2 %>
<% end %> <span class="circle-score circle-wrong bg-orange mr15"></span>
</span> <span class="text-orange mr3"><%= this_ques_status[:user_score] %></span>分
<% elsif q_type == 4 %> <% else %>
<span class="user-score"> <span class="circle-score circle-wrong bg-red mr15"></span>
<% if main_ques_status.present? && main_ques_status[:stand_status] == 1 %> <span class="text-red mr3">0.0</span>分
<span class="circle-score circle-right bg-green mr15"></span> <% end %>
<span class="text-green mr3"><%= main_ques_status[:user_score] %></span>分 </span>
<% elsif main_ques_status.present? && main_ques_status[:stand_status] == 2 %> <% elsif q_type == 4 %>
<span class="circle-score circle-wrong bg-orange mr15"></span> <span class="user-score">
<span class="text-orange mr3"><%= main_ques_status[:user_score] %></span>分 <% if main_ques_status.present? && main_ques_status[:stand_status] == 1 %>
<% else %> <span class="circle-score circle-right bg-green mr15"></span>
<span class="text-red">未批</span> <span class="text-green mr3"><%= main_ques_status[:user_score] %></span>分
<% end %> <% elsif main_ques_status.present? && main_ques_status[:stand_status] == 2 %>
</span> <span class="circle-score circle-wrong bg-orange mr15"></span>
<% else %> <span class="text-orange mr3"><%= main_ques_status[:user_score] %></span>分
<span class="user-score"> <% else %>
<% if this_ques_status.present? && this_ques_status[:stand_status] == 1 %> <span class="text-red">未批</span>
<span class="circle-score circle-right bg-green mr15"></span> <% end %>
<span class="text-green mr3"><%= this_ques_status[:user_score] %></span>分 </span>
<% elsif this_ques_status.present? && this_ques_status[:stand_status] == 2 %> <% else %>
<span class="circle-score circle-wrong bg-orange mr15"></span> <span class="user-score">
<span class="text-orange mr3"><%= this_ques_status[:user_score] %></span>分 <% if this_ques_status.present? && this_ques_status[:stand_status] == 1 %>
<% else %> <span class="circle-score circle-right bg-green mr15"></span>
<span class="circle-score circle-wrong bg-red mr15"></span> <span class="text-green mr3"><%= this_ques_status[:user_score] %></span>分
<span class="text-red mr3">0.0</span>分 <% elsif this_ques_status.present? && this_ques_status[:stand_status] == 2 %>
<% end %> <span class="circle-score circle-wrong bg-orange mr15"></span>
</span> <span class="text-orange mr3"><%= this_ques_status[:user_score] %></span>分
<% end %> <% else %>
</div> <span class="circle-score circle-wrong bg-red mr15"></span>
<div class="pbt5"> <span class="text-red mr3">0.0</span>分
<% if q_type == 5 %> <% end %>
<span class="ques-title"><%= q.shixun_name.html_safe %></span> </span>
<div class="mt8 text-gray"> <% end %>
<span><%= q.question_title.html_safe %></span> </div>
</div> <div class="pbt5">
<% elsif q_type == 4 %> <% if q_type == 5 %>
<span class="ques-title"><%= q.question_title.html_safe %></span> <span class="ques-title"><%= q.shixun_name&.html_safe %></span>
<% else %> <div class="mt8 text-gray">
<span class="ques-title"><%= q.question_title.html_safe %></span> <span><%= q.question_title&.html_safe %></span>
<% end %> </div>
</div> <% elsif q_type == 4 %>
</div> <span class="ques-title"><%= q.question_title&.html_safe %></span>
<div class="pbt5"> <% else %>
<% if q_type == 0 %> <span class="ques-title"><%= q.question_title&.html_safe %></span>
<% q.exercise_choices.each_with_index do |s,index| %> <% end %>
<% check_answer = (user_answer.present? && (s.id == user_answer.first.exercise_choice_id)) ? "choose-answer" : '' %> </div>
<p class="pbt5"> </div>
<span class="choose-radio <%= check_answer %>"></span> <div class="pbt5">
<span class="mr15"><%= convert_to_char((index+1).to_s)%></span><%= s.choice_text%> <% if q_type == 0 %>
</p> <% q.exercise_choices.each_with_index do |s,index| %>
<% end %> <% check_answer = (user_answer.present? && (s.id == user_answer.first.exercise_choice_id)) ? "choose-answer" : '' %>
<% elsif q_type == 1 %> <p class="pbt5">
<% q.exercise_choices.each_with_index do |s,index| %> <span class="choose-radio <%= check_answer %>"></span>
<% check_answer = (user_answer.present? && (user_answer.pluck(:exercise_choice_id).include?(s.id))) ? true : false %> <span class="mr15"><%= convert_to_char((index+1).to_s)%></span><%= s.choice_text%>
<p class="pbt5"> </p>
<% if check_answer %> <% end %>
<span class="choose-checkbox choose-answer-multi" ></span> <% elsif q_type == 1 %>
<% else %> <% q.exercise_choices.each_with_index do |s,index| %>
<span class="choose-checkbox"></span> <% check_answer = (user_answer.present? && (user_answer.pluck(:exercise_choice_id).include?(s.id))) ? true : false %>
<% end %> <p class="pbt5">
<span class="mr15"><%= convert_to_char((index+1).to_s)%></span><%= s.choice_text%> <% if check_answer %>
</p> <span class="choose-checkbox choose-answer-multi" ></span>
<% end %> <% else %>
<% elsif q_type == 2 %> <span class="choose-checkbox"></span>
<p class="pbt5"> <% end %>
<% q.exercise_choices.each do |s| %> <span class="mr15"><%= convert_to_char((index+1).to_s)%></span><%= s.choice_text%>
<% if user_answer.present? && (s.id == user_answer.first.exercise_choice_id) %> </p>
<% check_answer = 'choose-answer' %> <% end %>
<% else %> <% elsif q_type == 2 %>
<% check_answer = '' %> <p class="pbt5">
<% end %> <% q.exercise_choices.each do |s| %>
<span class="mr15"> <% if user_answer.present? && (s.id == user_answer.first.exercise_choice_id) %>
<span class="choose-radio <%= check_answer %>"></span> <% check_answer = 'choose-answer' %>
<span class="mlr5"><%= s.choice_text %></span> <% else %>
</span> <% check_answer = '' %>
<% end %> <% end %>
</p> <span class="mr15">
<% elsif q_type == 3 %> <span class="choose-radio <%= check_answer %>"></span>
<% st_counts = q.exercise_standard_answers.pluck(:exercise_choice_id).uniq %> <span class="mlr5"><%= s.choice_text %></span>
<% st_counts.each_with_index do |s,index| %> </span>
<% if user_answer.present? && user_answer.where(exercise_choice_id:s).present? %> <% end %>
<% check_answer = user_answer.where(exercise_choice_id:s).first.answer_text %> </p>
<% else %> <% elsif q_type == 3 %>
<% check_answer = "--" %> <% st_counts = q.exercise_standard_answers.pluck(:exercise_choice_id).uniq %>
<% end %> <% st_counts.each_with_index do |s,index| %>
<p class="pbt10 flex-nowrap"> <% if user_answer.present? && user_answer.where(exercise_choice_id:s).present? %>
<span class="pull-left line-34">答案(填空<%= index+1 %></span> <% check_answer = user_answer.where(exercise_choice_id:s).first.answer_text %>
<span class="null-answer"><%= check_answer.html_safe %></span> <% else %>
</p> <% check_answer = "--" %>
<% end %> <% end %>
<% elsif q_type == 4 %> <p class="pbt10 flex-nowrap">
<% check_answer = (user_answer.present? ? user_answer.first.answer_text : '--') %> <span class="pull-left line-34">答案(填空<%= index+1 %></span>
<p class="flex-nowrap"> <span class="null-answer"><%= check_answer&.html_safe %></span>
<span class="null-answer main-height"><%= check_answer.html_safe %></span> </p>
</p> <% end %>
<% else %> <% elsif q_type == 4 %>
<div class="mbt10"> <% check_answer = (user_answer.present? ? user_answer.first.answer_text : '--') %>
<p class="text-gray mbt10"> <p class="flex-nowrap">
<span>阶段成绩</span> <span class="null-answer main-height"><%= check_answer&.html_safe %></span>
</p> </p>
<table style="width:100%;" cellpadding="0" cellspacing="0" > <% else %>
<thead class="bgc"> <div class="mbt10">
<th width="6%">关卡</th> <p class="text-gray mbt10">
<th width="29%" style="text-align: left;">任务名称</th> <span>阶段成绩</span>
<th width="10%">评测次数</th> </p>
<th width="13%">完成时间</th> <table style="width:100%;" cellpadding="0" cellspacing="0" >
<th width="16%">耗时</th> <thead class="bgc">
<th width="13%">经验值</th> <th width="6%">关卡</th>
<th width="13%">得分/满分</th> <th width="29%" style="text-align: left;">任务名称</th>
</thead> <th width="10%">评测次数</th>
<tbody> <th width="13%">完成时间</th>
<% if @games.size > 0 %> <th width="16%">耗时</th>
<% @games.each_with_index do |game, index| %> <th width="13%">经验值</th>
<% user_score = q.exercise_shixun_answers.where(exercise_shixun_challenge_id:game.challenge.id,user_id: @ex_user_user.id) %> <th width="13%">得分/满分</th>
<% game_score = q.exercise_shixun_challenges.where(challenge_id:game.challenge.id) %> </thead>
<tr> <tbody>
<td><%= index + 1 %></td> <% if @games.size > 0 %>
<td style="text-align: left;"> <% @games.each_with_index do |game, index| %>
<span class="task-hide edu-info-dark fl"><%= game.challenge.subject %></span> <% user_score = q.exercise_shixun_answers.where(exercise_shixun_challenge_id:game.challenge.id,user_id: @ex_user_user.id) %>
</td> <% game_score = q.exercise_shixun_challenges.where(challenge_id:game.challenge.id) %>
<td><%= game.evaluate_count %></td> <tr>
<td><%= game.end_time.present? ? game.end_time.strftime("%Y-%m-%d %H:%M") : "--" %></td> <td><%= index + 1 %></td>
<td><%= ApplicationController.helpers.time_consuming game %></td> <td style="text-align: left;">
<td><span class="text-green"><%= game.final_score %></span> / <%= game.challenge.all_score %></td> <span class="task-hide edu-info-dark fl"><%= game.challenge.subject %></span>
<td><span class="text-orange"><%= user_score.present? ? user_score.first.score : 0.0 %> /</span> <%= game_score.present? ? game_score.first.question_score : 0.0 %></td> </td>
</tr> <td><%= game.evaluate_count %></td>
<% end %> <td><%= game.end_time.present? ? game.end_time.strftime("%Y-%m-%d %H:%M") : "--" %></td>
<% else %> <td><%= ApplicationController.helpers.time_consuming game %></td>
<% q.exercise_shixun_challenges.each_with_index do |game, index| %> <td><span class="text-green"><%= game.final_score %></span> / <%= game.challenge.all_score %></td>
<% game_score = q.exercise_shixun_challenges.where(challenge_id:game.challenge.id) %> <td><span class="text-orange"><%= user_score.present? ? user_score.first.score : 0.0 %> /</span> <%= game_score.present? ? game_score.first.question_score : 0.0 %></td>
<tr> </tr>
<td><%= index + 1 %></td> <% end %>
<td style="text-align: left;"> <% else %>
<span class="task-hide edu-info-dark fl"><%= game.challenge.subject %></span> <% q.exercise_shixun_challenges.each_with_index do |game, index| %>
</td> <% game_score = q.exercise_shixun_challenges.where(challenge_id:game.challenge.id) %>
<td>0</td> <tr>
<td>--</td> <td><%= index + 1 %></td>
<td>--</td> <td style="text-align: left;">
<td><span class="text-green">0.0</span> / <%= game.challenge.all_score %></td> <span class="task-hide edu-info-dark fl"><%= game.challenge.subject %></span>
<td><span class="text-orange">0.0 /</span> <%= game_score.present? ? game_score.first.question_score : 0.0 %></td> </td>
</tr> <td>0</td>
<% end %> <td>--</td>
<% end %> <td>--</td>
</tbody> <td><span class="text-green">0.0</span> / <%= game.challenge.all_score %></td>
</table> <td><span class="text-orange">0.0 /</span> <%= game_score.present? ? game_score.first.question_score : 0.0 %></td>
</div> </tr>
<div class="mbt10"> <% end %>
<p class="text-gray mbt10"> <% end %>
<span class="fl font-bd">实训详情</span> </tbody>
</p> </table>
<% @games.each_with_index do |game, index| %> </div>
<div class="mbt10"> <div class="mbt10">
<p class="clearfix"> <p class="text-gray mbt10">
<span class="fl mt3"><span class="font-bd mr15">第<%= index+1 %>关</span><%= game.challenge.subject %></span> <span class="fl font-bd">实训详情</span>
</p> </p>
<div style="margin-left: 32px;" class="mt8 shixun-detail"> <% @games.each_with_index do |game, index| %>
<% if game.outputs.present? %> <div class="mbt10">
<table style="width:100%;" cellpadding="0" cellspacing="0"> <p class="clearfix">
<thead class="bgc"> <span class="fl mt3"><span class="font-bd mr15">第<%= index+1 %>关</span><%= game.challenge.subject %></span>
<th width="10%">评测次数</th> </p>
<th>评测信息</th> <div style="margin-left: 32px;" class="mt8 shixun-detail">
</thead> <% if game.outputs.present? %>
<tbody> <table style="width:100%;" cellpadding="0" cellspacing="0">
<% outputs = game.outputs.group("query_index") %> <thead class="bgc">
<% outputs.reverse.try(:each) do |output| %> <th width="10%">评测次数</th>
<tr> <th>评测信息</th>
<td><%= "第#{output.query_index}次" %></td> </thead>
<td align="left" style="padding-left: 5px"><%= output_detail(game, output) %></td> <tbody>
</tr> <% outputs = game.outputs.group("query_index") %>
<% end %> <% outputs.reverse.try(:each) do |output| %>
</tbody> <tr>
</table> <td><%= "第#{output.query_index}次" %></td>
<% end %> <td align="left" style="padding-left: 5px"><%= output_detail(game, output) %></td>
<% if game.try(:lastest_code).present? && game.challenge.st == 0 %> </tr>
<% con_rows = content_line(game.lastest_code) %> <% end %>
<div class="mbt20"> </tbody>
<p class="bgc" > </table>
<span class="pd10" style="display:inherit;"> <% end %>
<span class="fl">最近通过的代码</span> <% if game.try(:lastest_code).present? && game.challenge.st == 0 %>
<span class="pull-right"><%= game.challenge.path %></span> <% con_rows = content_line(game.lastest_code) %>
</span> <div class="mbt20">
</p> <p class="bgc" >
<div class="bg-e pd10"> <span class="pd10" style="display:inherit;">
<textarea class="" id="content_show_<%= game.id %>" name="content" rows="<%= con_rows %>"><%= game.lastest_code %></textarea> <span class="fl">最近通过的代码</span>
</div> <span class="pull-right"><%= game.challenge.path %></span>
</div> </span>
<% end %> </p>
</div> <div class="bg-e pd10">
</div> <textarea class="" id="content_show_<%= game.id %>" name="content" rows="<%= con_rows %>"><%= game.lastest_code %></textarea>
<% end %> </div>
</div> </div>
<% end %> <% end %>
</div> </div>
</div> </div>
</div> <% end %>
<% if ques_comment.present? && ques_comment.first.comment.present? %> </div>
<% ques_user = ques_comment.first.user %> <% end %>
<div class="bdc"> </div>
<div class="pbt10"> </div>
<div class="inline-block pull-left"> </div>
<span><img src="/images/avatars/User/<%= ques_user.id %>" class="avatar-32"/></span> <% if ques_comment.present? && ques_comment.first.comment.present? %>
</div> <% ques_user = ques_comment.first.user %>
<div class="ml38"> <div class="bdc">
<p class="mb10"><span class="pr"><%= ques_user.real_name %></span><span class="plr15 text-gray"><%= ques_comment.first.updated_at.strftime('%Y-%m-%d %H:%M') %></span></p> <div class="pbt10">
<p><%= ques_comment.first.comment %></p> <div class="inline-block pull-left">
</div> <span><img src="/images/avatars/User/<%= ques_user.id %>" class="avatar-32"/></span>
</div> </div>
</div> <div class="ml38">
<% end %> <p class="mb10"><span class="pr"><%= ques_user.real_name %></span><span class="plr15 text-gray"><%= ques_comment.first.updated_at.strftime('%Y-%m-%d %H:%M') %></span></p>
<% end %> <p><%= ques_comment.first.comment %></p>
</div> </div>
</div> </div>
</div> </div>
</body> <% end %>
</html> <% end %>
</div>
</div>
</div>
</body>
</html>

@ -1,6 +1,9 @@
json.(@base_date, :st, :discusses_count, :game_count, :record_onsume_time, :prev_game, :next_game, :praise_count, json.(@base_date, :st, :discusses_count, :game_count, :record_onsume_time, :prev_game, :next_game, :praise_count,
:user_praise, :time_limit, :tomcat_url, :is_teacher, :myshixun_manager, :game, :challenge, :user_praise, :time_limit, :tomcat_url, :is_teacher, :myshixun_manager, :game, :challenge,
:shixun, :myshixun) :shixun, :myshixun)
if @shixun.vnc
json.vnc_url @vnc_url
end
json.user do json.user do
json.partial! 'users/user', user: @user json.partial! 'users/user', user: @user
json.identity @identity json.identity @identity

@ -14,6 +14,7 @@ json.commits commits do |commit|
json.author do json.author do
json.id nil json.id nil
json.login nil json.login nil
json.image_url "avatars/User/b"
json.name commit["author_name"] json.name commit["author_name"]
json.email commit["author_email"] json.email commit["author_email"]
end end

@ -1,4 +1,4 @@
json.status shixun.status json.shixun_status shixun.status
# REDO:前端需要通过status来判断发布 # REDO:前端需要通过status来判断发布
json.task_operation task_operation_url(current_myshixun, shixun) json.task_operation task_operation_url(current_myshixun, shixun)

@ -4,5 +4,4 @@ json.name user.full_name
json.grade user.grade json.grade user.grade
# json.email user.mail # 邮箱原则上不暴露的,如果实在需要的话只能对某些具体的接口公开 # json.email user.mail # 邮箱原则上不暴露的,如果实在需要的话只能对某些具体的接口公开
json.image_url url_to_avatar(user) json.image_url url_to_avatar(user)
json.user_url user_path(user)
json.school user.school_name json.school user.school_name

@ -0,0 +1,76 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports.
config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
config.cache_store = :file_store, "#{Rails.root }/files/cache_store/"
# if Rails.root.join('tmp', 'caching-dev.txt').exist?
# config.action_controller.perform_caching = true
#
# config.cache_store = :memory_store
# config.public_file_server.headers = {
# 'Cache-Control' => "public, max-age=#{2.days.to_i}"
# }
# else
# config.action_controller.perform_caching = false
#
# config.cache_store = :null_store
# end
# Store uploaded files on the local file system (see config/storage.yml for options)
config.active_storage.service = :local
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Suppress logger output for asset requests.
config.assets.quiet = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.action_controller.perform_caching = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.exmail.qq.com',
port: 25,
domain: 'smtp.qq.com',
user_name: 'educoder@trustie.org',
password: 'mAZc9EWbe2Kawaqo2',
authentication: 'login',
enable_starttls_auto: true }
end

@ -96,7 +96,8 @@ Rails.application.configure do
config.active_record.belongs_to_required_by_default = false config.active_record.belongs_to_required_by_default = false
# config.cache_store = :file_store, "#{Rails.root }/files/cache_store/" # config.cache_store = :file_store, "#{Rails.root }/files/cache_store/"
config.cache_store = :redis_store, 'redis://r-bp122bd1b710f274.redis.rds.aliyuncs.com:6379/0/cache', { expires_in: 90.minutes } #config.cache_store = :redis_store, 'redis://r-bp122bd1b710f274.redis.rds.aliyuncs.com:6379/0/cache', { expires_in: 90.minutes }
config.cache_store = :redis_store, 'redis://10.9.72.102:6379/0/cache', { expires_in: 90.minutes }
config.action_mailer.delivery_method = :smtp config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { config.action_mailer.smtp_settings = {

@ -1,11 +1,14 @@
PDFKit.configure do |config| PDFKit.configure do |config|
config.wkhtmltopdf = ENV["WKHTMLTOPDF_EXEC"] || 'wkhtmltopdf' # config.wkhtmltopdf = ENV["WKHTMLTOPDF_EXEC"] || 'wkhtmltopdf'
config.wkhtmltopdf = ENV["WKHTMLTOPDF_EXEC"] || '/usr/bin/wkhtmltopdf'
config.default_options = { config.default_options = {
encoding: "UTF-8",
page_size: 'A4', page_size: 'A4',
print_media_type: true, print_media_type: true,
dpi: 300, dpi: 300,
debug_javascript: true, debug_javascript: true,
javascript_delay: 500, javascript_delay: 500,
# quiet: false
stop_slow_scripts:false, stop_slow_scripts:false,
no_stop_slow_scripts: true no_stop_slow_scripts: true
} }

Loading…
Cancel
Save