diff --git a/.gitignore b/.gitignore index 309e960d7..4f52644ff 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,7 @@ public/upload.html /config/configuration.yml +/config/environments/production.rb /config/initializers/gitlab_config.rb /db/schema.rb .vscode/ diff --git a/Gemfile b/Gemfile index dfc9d41fd..f7c7e487a 100644 --- a/Gemfile +++ b/Gemfile @@ -45,12 +45,12 @@ gem 'rqrcode_png' 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 'rspec-rails', '~> 3.8' end -group :development do +group :'development.rb.example' do gem 'awesome_print' gem 'web-console', '>= 3.3.0' gem 'listen', '>= 3.0.5', '< 3.2' diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1915281bf..4a9220939 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -126,6 +126,13 @@ class ApplicationController < ActionController::Base end end + # 课堂教师、课堂管理员、超级管理员的权限(不包含助教) + def teacher_or_admin_allowed + unless current_user.course_identity(@course) < Course::ASSISTANT_PROFESSOR + normal_status(403, "") + end + end + def require_admin normal_status(403, "") unless User.current.admin? end @@ -176,19 +183,20 @@ class ApplicationController < ActionController::Base # 系统全局认证 # def check_auth - old_edu_host = edu_setting('old_edu_host') - ue = current_user.user_extension - - if current_user.lastname.blank? || ue.school_id.blank? || ue.identity.blank? || current_user.mail.blank? - info_url = old_edu_host + '/account/user_info' - render :json => { status: 402, url: info_url } - elsif current_user.certification != 1 - day_cer = UserDayCertification.where(user_id: current_user.id).last - unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 - account_url = old_edu_host + "/my/account" - render :json => { status: 402, url: account_url } - end - end + # old_edu_host = edu_setting('old_edu_host') + # ue = current_user.user_extension + # + # if current_user.lastname.blank? || ue.school_id.blank? || ue.identity.blank? || current_user.mail.blank? + # info_url = old_edu_host + '/account/user_info' + # render :json => { status: 402, url: info_url } + # elsif current_user.certification != 1 + # day_cer = UserDayCertification.where(user_id: current_user.id).last + # unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 + # account_url = old_edu_host + "/my/account" + # render :json => { status: 402, url: account_url } + # end + # end + true end # 身份资料的认证: diff --git a/app/controllers/course_groups_controller.rb b/app/controllers/course_groups_controller.rb index 8b6737e0f..bee3fa09d 100644 --- a/app/controllers/course_groups_controller.rb +++ b/app/controllers/course_groups_controller.rb @@ -2,7 +2,7 @@ class CourseGroupsController < ApplicationController before_action :require_login before_action :set_group, except: [:create] before_action :find_course, only: [:create] - before_action :teacher_allowed + before_action :teacher_or_admin_allowed def create tip_exception("分班名称不能为空") if params[:name].blank? diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 3d0926994..b76673945 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -25,11 +25,11 @@ class CoursesController < ApplicationController before_action :teacher_allowed, only: [:update, :destroy, :settings, :search_teacher_candidate, :transfer_to_course_group, :delete_from_course, :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, - :set_course_group, :change_course_admin, :change_course_teacher, - :delete_course_teacher, :teacher_application_review, :create_group_by_importing_file] + before_action :admin_allowed, only: [:set_invite_code_halt, :set_public_or_private, :change_course_admin, + :set_course_group, :delete_course_teacher, :teacher_application_review, + :create_group_by_importing_file] 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 :find_board, only: :board_list before_action :validate_page_size, only: :mine diff --git a/app/controllers/exercise_questions_controller.rb b/app/controllers/exercise_questions_controller.rb index 9e3259e6e..a0b88a97e 100644 --- a/app/controllers/exercise_questions_controller.rb +++ b/app/controllers/exercise_questions_controller.rb @@ -480,7 +480,7 @@ class ExerciseQuestionsController < ApplicationController ex_answers = @exercise_question.exercise_answers.search_answer_users("user_id",@user_id) #当前用户答案的得分 if @exercise_question.question_type == 3 #当为填空题,更新问题的总分, 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 total_scores = new_obj_score + ex_subj_score 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_type].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!") 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分!") @@ -677,7 +677,7 @@ class ExerciseQuestionsController < ApplicationController end def check_adjust_score - @c_score = params[:score].to_f.round(1) #调分后的分数 + @c_score = params[:score].to_f #调分后的分数 @user_id = params[:user_id] @exercise_current_user = @exercise.exercise_users.exercise_commit_users(@user_id).first #当前试卷用户的答案内容 if @exercise_current_user.blank? diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 4aa0b13b8..79167150e 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -62,6 +62,22 @@ class GamesController < ApplicationController praise_count: praise_count, user_praise: user_praise, time_limit: time_limit, tomcat_url: edu_setting('cloud_tomcat_php'), is_teacher: is_teacher, 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 # 区分选择题和编程题,st:0编程题; if @st == 0 diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index e4ed35b4b..6217b08c3 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -200,10 +200,15 @@ class HomeworkCommonsController < ApplicationController if @user_course_identity >= Course::STUDENT tip_exception(403, "无权限操作") else - student_work_to_xlsx(@work_excel,@homework) - exercise_export_name = current_user.real_name + "_" + @course.name + "_" + @homework.name + "_" + Time.now.strftime('%Y%m%d_%H%M%S') - 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} + if @work_excel.present? + student_work_to_xlsx(@work_excel,@homework) + exercise_export_name = current_user.real_name + "_" + @course.name + "_" + @homework.name + "_" + Time.now.strftime('%Y%m%d_%H%M%S') + 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 } format.zip{ diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 042945b6e..91cff3c19 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -1,7 +1,7 @@ class MyshixunsController < ApplicationController before_action :require_login, :except => [:training_task_status, :code_runinng_message] - before_action :find_myshixun, :except => [:training_task_status] - before_action :find_repo_name, :except => [:training_task_status] + before_action :find_myshixun, :except => [:training_task_status, :code_runinng_message] + before_action :find_repo_name, :except => [:training_task_status, :code_runinng_message] skip_before_action :verify_authenticity_token, :only => [:html_content] ## TPI关卡列表 diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 6dfa94252..8359b14f9 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -1,5 +1,5 @@ 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 :find_shixun, except: [:index, :new, :create, :menus, :get_recommend_shixuns, :propaedeutics, @@ -492,6 +492,7 @@ class ShixunsController < ApplicationController if current_myshixun # 如果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 # 这里页面弹框要收到 当前用户myshixun的identifier. tip_show_exception("/myshixuns/#{current_myshixun.try(:identifier)}/reset_my_game") diff --git a/app/controllers/zips_controller.rb b/app/controllers/zips_controller.rb index 89f473499..a8750fc3d 100644 --- a/app/controllers/zips_controller.rb +++ b/app/controllers/zips_controller.rb @@ -21,6 +21,7 @@ class ZipsController < ApplicationController file_name = filename_for_content_disposition(exercises.filename) send_file exercises.ex_zip, filename: file_name, type: 'application/zip' + rescue Exception => e normal_status(-1, e.message) end @@ -39,7 +40,7 @@ class ZipsController < ApplicationController def get_exercise ActiveRecord::Base.transaction do 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] if @exercise.blank? normal_status(-1,"试卷不存在") diff --git a/app/decorators/user_decorator.rb b/app/decorators/user_decorator.rb index a0f9f7fdd..463d9a6e3 100644 --- a/app/decorators/user_decorator.rb +++ b/app/decorators/user_decorator.rb @@ -14,12 +14,14 @@ module UserDecorator # 关注数 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 # 粉丝数 def fan_count - watchers.count + Watcher.where(watchable_type: %w(Principal User), watchable_id: id).count + # watchers.count end # 是否绑定邮箱 diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 8c88f02d0..226a45570 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -246,15 +246,18 @@ module CoursesHelper def left_group_info course group_info = [] - course.course_groups.each do |course_group| - group_info << {category_id: course_group.id, category_name: course_group.name, position: course_group.position, - category_count: course_group.course_members_count, category_type: false, - second_category_url: "/courses/#{@course.id}/course_groups/#{course_group.id}"} + if course.course_groups_count > 0 + course.course_groups.each do |course_group| + group_info << {category_id: course_group.id, category_name: course_group.name, position: course_group.position, + 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 - 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"} + group_info end end diff --git a/app/helpers/export_helper.rb b/app/helpers/export_helper.rb index a5e3c5d9d..918995bef 100644 --- a/app/helpers/export_helper.rb +++ b/app/helpers/export_helper.rb @@ -245,7 +245,7 @@ module ExportHelper else user_course = "--" 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_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 diff --git a/app/models/user.rb b/app/models/user.rb index 0d5517c50..8e25efe70 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -260,7 +260,7 @@ class User < ApplicationRecord # 实训管理员:实训合作者、admin 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 # 实训管理员 diff --git a/app/services/exercise_user_pdf_service.rb b/app/services/exercise_user_pdf_service.rb index 5f92aee9c..d74e66d31 100644 --- a/app/services/exercise_user_pdf_service.rb +++ b/app/services/exercise_user_pdf_service.rb @@ -41,7 +41,6 @@ class ExerciseUserPdfService # aa = File.open(Rails.root.join("public/123.html"),"w+") # aa.syswrite(kit.source) #正式需删掉------- - file = Tempfile.new(filename) kit.to_pdf(file.path) file diff --git a/app/templates/exercise_export/blank_exercise.html.erb b/app/templates/exercise_export/blank_exercise.html.erb index 61bde0d27..2745f8cbe 100644 --- a/app/templates/exercise_export/blank_exercise.html.erb +++ b/app/templates/exercise_export/blank_exercise.html.erb @@ -13,13 +13,13 @@
- <%= @exercise.try(:exercise_description).nil? ? "" : @exercise.try(:exercise_description).html_safe %> + <%= @exercise.try(:exercise_description).nil? ? "" : @exercise.try(:exercise_description)&.html_safe %>
<% if @exercise_single_ques_count > 0 %> 单选题<%= @exercise_single_ques_count %>题, 共<%= @exercise_single_ques_scores %>分 @@ -44,10 +44,16 @@ 实训题<%= @exercise_ques_shixun_count %>题, 共<%= @exercise_ques_shixun_scores %>分 <% end %> -
- <%= @exercise.try(:exercise_description).nil? ? "" : @exercise.try(:exercise_description).html_safe %> -
-- 客观题 - 正确 - 错误 - 部分得分 - 总分:<%= @exercise_user.score %>分 -
-- 主观题 - 已评 - 未评 - 开始答题时间:<%= @exercise_user.start_at.present? ? @exercise_user.start_at.strftime("%Y-%m-%d %H:%M") : "--" %> -
-- - <%= convert_to_char((index+1).to_s)%><%= s.choice_text%> -
- <% end %> - <% elsif q_type == 1 %> - <% q.exercise_choices.each_with_index do |s,index| %> - <% check_answer = (user_answer.present? && (user_answer.pluck(:exercise_choice_id).include?(s.id))) ? true : false %> -- <% if check_answer %> - - <% else %> - - <% end %> - <%= convert_to_char((index+1).to_s)%><%= s.choice_text%> -
- <% end %> - <% elsif q_type == 2 %> -- <% q.exercise_choices.each do |s| %> - <% if user_answer.present? && (s.id == user_answer.first.exercise_choice_id) %> - <% check_answer = 'choose-answer' %> - <% else %> - <% check_answer = '' %> - <% end %> - - - <%= s.choice_text %> - - <% end %> -
- <% elsif q_type == 3 %> - <% st_counts = q.exercise_standard_answers.pluck(:exercise_choice_id).uniq %> - <% st_counts.each_with_index do |s,index| %> - <% if user_answer.present? && user_answer.where(exercise_choice_id:s).present? %> - <% check_answer = user_answer.where(exercise_choice_id:s).first.answer_text %> - <% else %> - <% check_answer = "--" %> - <% end %> -- 答案(填空<%= index+1 %>): - <%= check_answer.html_safe %> -
- <% end %> - <% elsif q_type == 4 %> - <% check_answer = (user_answer.present? ? user_answer.first.answer_text : '--') %> -- <%= check_answer.html_safe %> -
- <% else %> -- 阶段成绩 -
-关卡 | -任务名称 | -评测次数 | -完成时间 | -耗时 | -经验值 | -得分/满分 | - - - <% if @games.size > 0 %> - <% @games.each_with_index do |game, index| %> - <% user_score = q.exercise_shixun_answers.where(exercise_shixun_challenge_id:game.challenge.id,user_id: @ex_user_user.id) %> - <% game_score = q.exercise_shixun_challenges.where(challenge_id:game.challenge.id) %> -
---|---|---|---|---|---|---|
<%= index + 1 %> | -- <%= game.challenge.subject %> - | -<%= game.evaluate_count %> | -<%= game.end_time.present? ? game.end_time.strftime("%Y-%m-%d %H:%M") : "--" %> | -<%= ApplicationController.helpers.time_consuming game %> | -<%= game.final_score %> / <%= game.challenge.all_score %> | -<%= user_score.present? ? user_score.first.score : 0.0 %> / <%= game_score.present? ? game_score.first.question_score : 0.0 %> | -
<%= index + 1 %> | -- <%= game.challenge.subject %> - | -0 | --- | --- | -0.0 / <%= game.challenge.all_score %> | -0.0 / <%= game_score.present? ? game_score.first.question_score : 0.0 %> | -
- 实训详情 -
- <% @games.each_with_index do |game, index| %> -- 第<%= index+1 %>关<%= game.challenge.subject %> -
-评测次数 | -评测信息 | - - - <% outputs = game.outputs.group("query_index") %> - <% outputs.reverse.try(:each) do |output| %> -
---|---|
<%= "第#{output.query_index}次" %> | -<%= output_detail(game, output) %> | -
- - 最近通过的代码 - <%= game.challenge.path %> - -
-<%= ques_user.real_name %><%= ques_comment.first.updated_at.strftime('%Y-%m-%d %H:%M') %>
-<%= ques_comment.first.comment %>
-+ <%= @exercise.try(:exercise_description).nil? ? "" : @exercise.try(:exercise_description)&.html_safe %> +
++ <% if @exercise_single_ques_count > 0 %> + 单选题<%= @exercise_single_ques_count %>题, + 共<%= @exercise_single_ques_scores %>分 + <% end %> + <% if @exercise_double_ques_count > 0 %> + 多选题<%= @exercise_double_ques_count %>题, + 共<%= @exercise_double_ques_scores %>分 + <% end %> + <% if @exercise_ques_judge_count > 0 %> + 判断题<%= @exercise_ques_judge_count %>题, + 共<%= @exercise_ques_judge_scores %>分 + <% end %> + <% if @exercise_ques_null_count > 0 %> + 填空题<%= @exercise_ques_null_count %>题, + 共<%= @exercise_ques_null_scores %>分 + <% end %> + <% if @exercise_ques_main_count > 0 %> + 主观题<%= @exercise_ques_main_count %>题, + 共<%= @exercise_ques_main_scores %>分 + <% end %> + <% if @exercise_ques_shixun_count > 0 %> + 实训题<%= @exercise_ques_shixun_count %>题, + 共<%= @exercise_ques_shixun_scores %>分 + <% end %> + + <% if @exercise_ques_count > 0 %> + + 共<%= @exercise_ques_scores %>分 + + + 合计<%= @exercise_ques_count %>题 + + <% end %> +
++ 客观题 + 正确 + 错误 + 部分得分 + 总分:<%= @exercise_user&.score %>分 +
++ 主观题 + 已评 + 未评 + 开始答题时间:<%= @exercise_user.start_at.present? ? @exercise_user.start_at.strftime("%Y-%m-%d %H:%M") : "--" %> +
++ + <%= convert_to_char((index+1).to_s)%><%= s.choice_text%> +
+ <% end %> + <% elsif q_type == 1 %> + <% q.exercise_choices.each_with_index do |s,index| %> + <% check_answer = (user_answer.present? && (user_answer.pluck(:exercise_choice_id).include?(s.id))) ? true : false %> ++ <% if check_answer %> + + <% else %> + + <% end %> + <%= convert_to_char((index+1).to_s)%><%= s.choice_text%> +
+ <% end %> + <% elsif q_type == 2 %> ++ <% q.exercise_choices.each do |s| %> + <% if user_answer.present? && (s.id == user_answer.first.exercise_choice_id) %> + <% check_answer = 'choose-answer' %> + <% else %> + <% check_answer = '' %> + <% end %> + + + <%= s.choice_text %> + + <% end %> +
+ <% elsif q_type == 3 %> + <% st_counts = q.exercise_standard_answers.pluck(:exercise_choice_id).uniq %> + <% st_counts.each_with_index do |s,index| %> + <% if user_answer.present? && user_answer.where(exercise_choice_id:s).present? %> + <% check_answer = user_answer.where(exercise_choice_id:s).first.answer_text %> + <% else %> + <% check_answer = "--" %> + <% end %> ++ 答案(填空<%= index+1 %>): + <%= check_answer&.html_safe %> +
+ <% end %> + <% elsif q_type == 4 %> + <% check_answer = (user_answer.present? ? user_answer.first.answer_text : '--') %> ++ <%= check_answer&.html_safe %> +
+ <% else %> ++ 阶段成绩 +
+关卡 | +任务名称 | +评测次数 | +完成时间 | +耗时 | +经验值 | +得分/满分 | + + + <% if @games.size > 0 %> + <% @games.each_with_index do |game, index| %> + <% user_score = q.exercise_shixun_answers.where(exercise_shixun_challenge_id:game.challenge.id,user_id: @ex_user_user.id) %> + <% game_score = q.exercise_shixun_challenges.where(challenge_id:game.challenge.id) %> +
---|---|---|---|---|---|---|
<%= index + 1 %> | ++ <%= game.challenge.subject %> + | +<%= game.evaluate_count %> | +<%= game.end_time.present? ? game.end_time.strftime("%Y-%m-%d %H:%M") : "--" %> | +<%= ApplicationController.helpers.time_consuming game %> | +<%= game.final_score %> / <%= game.challenge.all_score %> | +<%= user_score.present? ? user_score.first.score : 0.0 %> / <%= game_score.present? ? game_score.first.question_score : 0.0 %> | +
<%= index + 1 %> | ++ <%= game.challenge.subject %> + | +0 | +-- | +-- | +0.0 / <%= game.challenge.all_score %> | +0.0 / <%= game_score.present? ? game_score.first.question_score : 0.0 %> | +
+ 实训详情 +
+ <% @games.each_with_index do |game, index| %> ++ 第<%= index+1 %>关<%= game.challenge.subject %> +
+评测次数 | +评测信息 | + + + <% outputs = game.outputs.group("query_index") %> + <% outputs.reverse.try(:each) do |output| %> +
---|---|
<%= "第#{output.query_index}次" %> | +<%= output_detail(game, output) %> | +
+ + 最近通过的代码 + <%= game.challenge.path %> + +
+<%= ques_user.real_name %><%= ques_comment.first.updated_at.strftime('%Y-%m-%d %H:%M') %>
+<%= ques_comment.first.comment %>
+