diff --git a/app/controllers/commons_controller.rb b/app/controllers/commons_controller.rb index 1f6dce053..a23d4dba7 100644 --- a/app/controllers/commons_controller.rb +++ b/app/controllers/commons_controller.rb @@ -45,7 +45,13 @@ 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) >= Course::STUDENT && @object.author != current_user + 403 + else + 200 + end + when 'journals_for_message' + if current_user.course_identity(@object.jour.course) >= Course::STUDENT && @object.user != current_user 403 else 200 diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 9a7838a96..6af48dbd1 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -1040,6 +1040,7 @@ class ExercisesController < ApplicationController @exercise_questions = @exercise_questions.order("question_number ASC") end # 判断问题是否已回答还是未回答 + @exercise_questions = @exercise_questions.includes(:exercise_stand_answers,:exercise_answers,:exercise_shixun_answers) if @t_user_exercise_status == 3 get_each_student_exercise(@exercise.id,@exercise_questions,@exercise_current_user_id) @@ -1129,7 +1130,7 @@ class ExercisesController < ApplicationController @is_teacher_or = @user_course_identity < Course::STUDENT ? 1 : 0 @student_status = 2 # @exercise_answerer = User.find_by(id:@exercise_current_user_id) #试卷回答者 - @exercise_questions = @exercise.exercise_questions.order("question_number ASC") + @exercise_questions = @exercise.exercise_questions.includes(:exercise_shixun_challenges,:exercise_standard_answers,:exercise_answers,:exercise_shixun_answers).order("question_number ASC") @question_status = [] get_exercise_status = @exercise.get_exercise_status(current_user) if @ex_user.present? && @is_teacher_or == 0 @@ -1188,7 +1189,7 @@ class ExercisesController < ApplicationController elsif @user_course_identity > Course::ASSISTANT_PROFESSOR #当前为学生或者有过答题的(提交/未提交) @ex_user_end_time = @exercise.get_exercise_end_time(current_user.id) #当前用户所看到的剩余时间 @exercise_all_users = @exercise.get_stu_exercise_users - get_exercise_answers(@exercise_users_list, @exercise_status) # 未答和已答的 + get_exercise_answers(@exercise_all_users, @exercise_status) # 未答和已答的 exercise_current_user = @exercise_all_users.exercise_commit_users(current_user.id) #当前用户是否开始做试卷(提交/未提交/没做) if exercise_current_user.present? @exercise_current_user_status = 1 #当前用户的状态,为学生 @@ -1202,7 +1203,7 @@ class ExercisesController < ApplicationController end else @exercise_all_users = @exercise.get_stu_exercise_users - get_exercise_answers(@exercise_users_list, @exercise_status) # 未答和已答的 + get_exercise_answers(@exercise_all_users, @exercise_status) # 未答和已答的 @exercise_current_user_status = 2 #当前用户非课堂成员 @exercise_users_list = [] end diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 232250e4c..6f0f10f4d 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -118,11 +118,11 @@ class HomeworkCommonsController < ApplicationController # 学生已提交作品且补交(提交)已截止、作品公开、非匿评阶段 if @work&.work_status.to_i > 0 && (@homework.work_public || @homework.score_open) && - ((!@homework.anonymous_comment && @homework.end_or_late) || @homework_detail_manual.comment_status > 4) + ((!@homework.anonymous_comment && @homework.end_or_late) || (@homework_detail_manual.comment_status > 4 && @homework.end_or_late)) @student_works = student_works.where("user_id != #{@work.user_id}") # 匿评、申诉阶段只能看到分配给自己的匿评作品 - elsif @work&.work_status.to_i > 0 && @homework.anonymous_comment && @homework_detail_manual.comment_status > 2 + elsif @work&.work_status.to_i > 0 && @homework.anonymous_comment && @homework_detail_manual.comment_status > 2 && @homework_detail_manual.comment_status <= 4 @is_evaluation = true @student_works = student_works.joins(:student_works_evaluation_distributions).where( "student_works_evaluation_distributions.user_id = #{@current_user.id}") @@ -240,7 +240,7 @@ class HomeworkCommonsController < ApplicationController end def update_score - tip_exception("作业还未发布,暂不能计算成绩") if @homework.end_or_late_none_group + tip_exception("作业还未发布,暂不能计算成绩") if @homework.publish_time.nil? || @homework.publish_time > Time.now begin if @homework.unified_setting student_works = @homework.student_works @@ -1354,7 +1354,7 @@ class HomeworkCommonsController < ApplicationController if results.status == 0 code_info = results.code_info homework_challenge_settings = @homework.homework_challenge_settings - @challenges = @shixun.challenges.where(id: homework_challenge_settings.pluck(:challenge_id), st: 0).includes(:games) + @challenges = @shixun.challenges.where(id: homework_challenge_settings.pluck(:challenge_id), st: 0) @challenges = @challenges.map do |challenge| code_rate = 0 @@ -1368,24 +1368,8 @@ class HomeworkCommonsController < ApplicationController game = challenge.games.find_by(user_id: @user.id) end_time = game.end_time # 用户关卡的得分 - all_score = homework_challenge_settings.find_by(challenge_id: challenge.id).try(:score) - final_score = - if @student_work.challenge_work_scores.where(challenge_id: challenge.id).last.present? - @student_work.challenge_work_scores.where(:challenge_id => game.challenge_id).last.score - else - if game.status == 2 && ((game.end_time && game.end_time < @homework.end_time) || - (@homework.allow_late && (@course.end_date.nil? || - (game.end_time && game.end_time < @course.end_date.end_of_day)))) - answer_open_evaluation = @homework.homework_detail_manual.answer_open_evaluation - # 设置了查看答案也获得满分的话就取总分。否则取关卡的百分比分支 - if answer_open_evaluation.present? - all_score - else - # 关卡的百分比 * 作业设置的分数 = 总得分 - ((game.final_score) / challenge.score) * all_score - end - end - end + all_score = homework_challenge_settings.find_by(challenge_id: challenge.id).try(:score).to_f + final_score = @student_work.work_challenge_score game, all_score # 抄袭用户 copy_user = User.find_by_id(game_codes[0].target_user_id) copy_end_time = copy_user.games.find_by(challenge_id: challenge.id).try(:end_time) if copy_user.present? diff --git a/app/controllers/student_works_controller.rb b/app/controllers/student_works_controller.rb index 92d146c82..1c98db56c 100644 --- a/app/controllers/student_works_controller.rb +++ b/app/controllers/student_works_controller.rb @@ -631,16 +631,35 @@ class StudentWorksController < ApplicationController # 查重作品调分 def adjust_review_score - if params[:score].nil? || params[:challenge_id].nil? || params[:code_rate].nil? || params[:copy_user_id].nil? + tip_exception("缺少type参数") if params[:type].blank? || !["review", "report"].include?(params[:type]) + if params[:type] == "review" && (params[:score].nil? || params[:challenge_id].nil? || params[:code_rate].nil? || params[:copy_user_id].nil?) tip_exception("参数错误,score和challenge_id和code_rate和copy_user_id不能为空") + elsif params[:type] == "report" && (params[:score].nil? || params[:challenge_id].nil?) + tip_exception("参数错误,score和challenge_id") + end + challenge_setting = @homework.homework_challenge_settings.find_by(challenge_id: params[:challenge_id]) + challenge = challenge_setting&.challenge + tip_exception("不能小于零") if params[:score] < 0 + tip_exception("不能大于关卡分值:#{challenge_setting.score}分") if challenge_setting.score < params[:score] + + ActiveRecord::Base.transaction do + begin + if params[:type] == "review" + copy_user = User.find params[:copy_user_id] + comment = "代码查重结果显示与#{copy_user.try(:show_real_name)}的代码相似度#{params[:code_rate]}%" + else + comment = "根据实训报告中最终提交的代码调整第#{challenge.position}关分数" + end + challenge_score = @work.challenge_work_scores.create(challenge_id: params[:challenge_id], user_id: current_user.id, score: params[:score], + comment: comment) + challenge_score.create_tiding current_user.id + HomeworksService.new.update_myshixun_work_score @work, @work&.myshixun, @work&.myshixun&.games, @homework, @homework.homework_challenge_settings + rescue Exception => e + uid_logger(e.message) + tip_exception(e.message) + raise ActiveRecord::Rollback + end end - copy_user = User.find params[:copy_user_id] - comment = "代码查重结果显示与#{copy_user.try(:show_real_name)}的代码相似度#{params[:code_rate]}%" - @work.challenge_work_scores.create(challenge_id: params[:challenge_id], user_id: current_user.id, score: params[:score], - comment: comment) - HomeworksService.new.set_shixun_final_score(@work) - @work_score = @homework.student_works.find_by(id: @work.id).try(:work_score) - end diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 0b64cb916..314a90403 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -9,9 +9,29 @@ module ExercisesHelper @ex_obj_array = [] exercise_obj_status.each do |q| if q.question_type == 5 - ques_score = q.exercise_shixun_answers.search_shixun_answers("user_id",user_id).pluck(:score).sum + answers_content = q.exercise_shixun_answers.search_shixun_answers("user_id",user_id) else - ques_score = q.exercise_answers.search_answer_users("user_id",user_id).score_reviewed.pluck(:score).sum + answers_content = q.exercise_answers.search_answer_users("user_id",user_id) + end + + if q.question_type <= 2 + if answers_content.present? #学生有回答时 + answer_choice_array = [] + answers_content.each do |a| + answer_choice_array.push(a.exercise_choice.choice_position) #学生答案的位置 + end + user_answer_content = answer_choice_array.sort + standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个 + if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分 + ques_score = q.question_score + else + ques_score = 0.0 + end + else + ques_score = 0.0 + end + else + ques_score = answers_content.select(:score).pluck(:score).sum end if ques_score >= q.question_score #满分作答为正确 @@ -370,7 +390,8 @@ module ExercisesHelper standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个 if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分 if standard_answer.count > 0 - q_score_1 = (q.question_score.to_f / standard_answer.count) #当多选答案正确时,每个answer的分数均摊。 + q_score_1 = q.question_score + # q_score_1 = (q.question_score.to_f / standard_answer.count) #当多选答案正确时,每个answer的分数均摊。 else q_score_1 = 0.0 end @@ -641,6 +662,7 @@ module ExercisesHelper user_score = nil shixun_type = 0 question_comment = [] + # user_score_pre = nil if ques_type == 5 exercise_answers = q.exercise_shixun_answers.search_shixun_answers("user_id",ex_answerer_id) else @@ -648,10 +670,26 @@ module ExercisesHelper end if student_status == 2 #当前为老师,或为学生且已提交 user_score_pre = exercise_answers.score_reviewed - if ques_type == 4 && user_score_pre.blank? #主观题时,且没有大于0的分数时,为空 - user_score = nil - else + if ques_type == 4 #主观题时,且没有大于0的分数时,为空 + user_score = user_score_pre.present? ? user_score_pre.pluck(:score).sum : nil + elsif ques_type == 5 || ques_type == 3 user_score = user_score_pre.present? ? user_score_pre.pluck(:score).sum : 0.0 + else + if exercise_answers.present? #判断题和选择题时, + answer_choice_array = [] + exercise_answers.each do |a| + answer_choice_array.push(a.exercise_choice.choice_position) #学生答案的位置 + end + user_answer_content = answer_choice_array.sort + standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个 + if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分 + user_score = q.question_score + else + user_score = 0.0 + end + else + user_score = 0.0 + end end end @@ -659,9 +697,9 @@ module ExercisesHelper user_score = q.question_score end if ques_type <= 2 - answered_content = exercise_answers.pluck(:exercise_choice_id) + answered_content = exercise_answers&.pluck(:exercise_choice_id) elsif ques_type == 3 - exercise_answers.each do |a| + exercise_answers&.each do |a| u_answer = { "choice_id":a.exercise_choice_id, "answer_text": a.answer_text @@ -669,7 +707,7 @@ module ExercisesHelper answered_content.push(u_answer) end elsif ques_type == 4 - answered_content = exercise_answers.pluck(:answer_text) + answered_content = exercise_answers&.pluck(:answer_text) end if ques_type == 5 #存在实训题,及已经做了实训题的 if ex_status == 3 || is_teacher_or == 1 #如果试卷已截止,则可以看到分数,否则不能查看分数 diff --git a/app/helpers/export_helper.rb b/app/helpers/export_helper.rb index 7f64a99cd..76f51e498 100644 --- a/app/helpers/export_helper.rb +++ b/app/helpers/export_helper.rb @@ -100,7 +100,7 @@ module ExportHelper user_time = format_time(t.updated_at) user_score = t&.score user_comment = t.comment.present? ? t.comment : "--" - comment_title = "教师:#{user_name}\n时间:#{user_time.to_s}\n分数:#{user_score.to_s}分\n评语:#{user_comment}\n\n" + comment_title = "#{user_name}: #{user_time.to_s} #{user_score.to_s}分\n#{user_comment}\n\n" w_18 = w_18 + comment_title end else @@ -172,7 +172,7 @@ module ExportHelper user_time = format_time(t.updated_at) user_score = t&.score user_comment = t.comment.present? ? t.comment : "--" - comment_title = "教师:#{user_name}\n时间:#{user_time.to_s}\n分数:#{user_score.to_s}分\n评语:#{user_comment}\n\n" + comment_title = "#{user_name}: #{user_time.to_s} #{user_score.to_s}分\n#{user_comment}\n\n" # ("教师:" + user_name + "\n" + "时间:" + user_time.to_s + "\n" + "分数:" + user_score.to_s + "分" + "\n" + "评语:" + user_comment + "\n\n") w_18 = w_18 + comment_title end @@ -206,7 +206,7 @@ module ExportHelper head_cells_format = head_cells_format + ["交叉评分"] end - head_cells_format = head_cells_format + %w(迟交扣分 最终成绩 提交时间 更新时间) + head_cells_format = head_cells_format + %w(迟交扣分 最终成绩 提交时间 更新时间 评语) @head_cells_column = head_cells_format @task_cells_column = [] @@ -257,8 +257,22 @@ module ExportHelper w_13 = work.work_score.nil? ? "未评分" : work.work_score.round(1) w_14 = work.commit_time.present? ? format_time(work.commit_time) : "--" w_15 = work.update_time.present? ? format_time(work.update_time) : "--" - - row_cells_column = [w_1,w_2,w_3,w_3_1,w_4,w_5,w_6,w_7,w_8,w_9,w_10,w_11,w_12,w_13,w_14,w_15] + teacher_comments = work.graduation_work_scores + if teacher_comments.present? + w_16 = "" + teacher_comments.each do |t| + user_name = t.user&.real_name + user_time = format_time(t.updated_at) + user_score = t&.score + user_comment = t.comment.present? ? t.comment : "--" + comment_title = "#{user_name}: #{user_time.to_s} #{user_score.to_s}分\n#{user_comment}\n\n" + # ("教师:" + user_name + "\n" + "时间:" + user_time.to_s + "\n" + "分数:" + user_score.to_s + "分" + "\n" + "评语:" + user_comment + "\n\n") + w_16 = w_16 + comment_title + end + else + w_16 = "--" + end + row_cells_column = [w_1,w_2,w_3,w_3_1,w_4,w_5,w_6,w_7,w_8,w_9,w_10,w_11,w_12,w_13,w_14,w_15,w_16] row_cells_column = row_cells_column.reject(&:blank?) @task_cells_column.push(row_cells_column) diff --git a/app/models/challenge_work_score.rb b/app/models/challenge_work_score.rb index 8316e228b..1e7c9f7fe 100644 --- a/app/models/challenge_work_score.rb +++ b/app/models/challenge_work_score.rb @@ -2,4 +2,12 @@ class ChallengeWorkScore < ApplicationRecord belongs_to :user belongs_to :student_work belongs_to :challenge + has_many :tidings, as: :container, dependent: :destroy + + def create_tiding trigger_user_id + tidings << Tiding.new(user_id: student_work.user_id, trigger_user_id: trigger_user_id, container_id: id, + container_type: "ChallengeWorkScore", parent_container_id: student_work_id, + parent_container_type: "StudentWork", belong_container_id: student_work&.homework_common&.course_id, + belong_container_type: "Course", viewed: 0, tiding_type: "HomeworkCommon") + end end diff --git a/app/models/exercise.rb b/app/models/exercise.rb index f9efabbd8..3a4414ff9 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -104,7 +104,6 @@ class Exercise < ApplicationRecord published_group_ids end - #判断用户是否属于试卷分班的学生中 def check_user_in_course(user_id,user_identity) ex_group_settings = exercise_group_settings.pluck(:course_group_id) diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 335b898fb..ac64b92c1 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -260,4 +260,8 @@ class HomeworkCommon < ApplicationRecord self.homework_group_settings.where("end_time is not null").pluck(:end_time).max end + + def challenge_score challenge_id + homework_challenge_settings.find_by(challenge_id: challenge_id)&.score.to_f + end end diff --git a/app/models/poll.rb b/app/models/poll.rb index 381a7f359..e6a363f1d 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -86,15 +86,16 @@ class Poll < ApplicationRecord def poll_published_ids(user_id) current_user_groups = course.teacher_course_ids(user_id) if unified_setting - if course.none_group_count > 0 #有未分班的,则发布到未发布 - un_group_ids = [0] - else - un_group_ids = [] - end - (current_user_groups + un_group_ids).uniq #统一设置时,为当前用户的分班id + current_user_groups.uniq + # if course.none_group_count > 0 #有未分班的,则发布到未发布 + # un_group_ids = [0] + # else + # un_group_ids = [] + # end + # (current_user_groups + un_group_ids).uniq #统一设置时,为当前用户的分班id else ex_group_setting = poll_group_settings.select(:course_group_id).pluck("course_group_id").uniq - ex_group_setting & current_user_groups #当前用户有权限的已发布的分班id #非统一设置时,为当前用户有权限的且已发布分班的id + (ex_group_setting & current_user_groups).uniq #当前用户有权限的已发布的分班id #非统一设置时,为当前用户有权限的且已发布分班的id end end diff --git a/app/models/shixun.rb b/app/models/shixun.rb index c4345f90a..cb305efaf 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -73,9 +73,8 @@ class Shixun < ApplicationRecord # 实训用户tag def user_tags_name(user = User.current) - challenge_ids = challenges.pluck(:id) - user_challenge_ids = user.games.where(challenge_id: challenge_ids, status: 2).pluck(:challenge_id) - ChallengeTag.where(challenge_id: user_challenge_ids).pluck(:name).uniq + Shixun.joins(challenges: [:challenge_tags, :games]).where(games: {status: 2, user_id: user.id}, shixuns: {id:id}) + .pluck("challenge_tags.name").uniq end # 实训关卡tag @@ -158,13 +157,11 @@ class Shixun < ApplicationRecord # 实训评分信息 # return [实训评分, 5星评分比例, 4星评分比例, 3星评分比例, 2星评分比例, 1星评分比例] def shixun_preference_info - game_star_info = Game.find_by_sql("select g.star from - (games g left join (myshixuns m join shixuns s on s.id = m.shixun_id) on m.id = g.myshixun_id) - where g.star != 0 and s.id = #{self.id}") + game_star_info = Game.joins(challenge: :shixun).where(shixuns: {id: id}).where.not(games: {star: 0}).pluck(:star) star_info = [] if game_star_info.present? 5.downto(1) do |i| - star_info << ((game_star_info.select{|s| s.star == i}.count / game_star_info.count.to_f) * 100).round + star_info << ((game_star_info.select{|s| s == i}.count / game_star_info.count.to_f) * 100).round end sum = star_info.sum max = star_info.max @@ -175,7 +172,7 @@ class Shixun < ApplicationRecord star_info = star_info.map{|s| s == max ? s + 1 : s} end cnt = game_star_info.count - sum = game_star_info.sum(&:star) + sum = game_star_info.sum star_info.unshift((sum / cnt.to_f).round(1)) else star_info = [5.0, 100, 0, 0, 0, 0] diff --git a/app/models/student_work.rb b/app/models/student_work.rb index d5b746ebd..9151ca501 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -193,4 +193,19 @@ class StudentWork < ApplicationRecord def scored? student_works_scores.where.not(reviewer_role: 3).exists? end + + def work_challenge_score game, score + game_score = 0 + adjust_score = challenge_work_scores.where(challenge_id: game.challenge_id).last + if adjust_score.present? + game_score = adjust_score.score + else + setting = homework_common.homework_group_setting user_id + if game.status == 2 && ((game.end_time && game.end_time < setting.end_time) || (homework_common.allow_late && game.end_time && game.end_time < homework_common.late_time)) + answer_open_evaluation = homework_common.homework_detail_manual.answer_open_evaluation + game_score = answer_open_evaluation ? score : (game.final_score > 0 ? game.real_score(score) : 0) + end + end + game_score + end end diff --git a/app/views/courses/export_member_scores_excel.xlsx.axlsx b/app/views/courses/export_member_scores_excel.xlsx.axlsx index da8c05f7a..5b226a09c 100644 --- a/app/views/courses/export_member_scores_excel.xlsx.axlsx +++ b/app/views/courses/export_member_scores_excel.xlsx.axlsx @@ -4,7 +4,7 @@ wb.styles do |s| no_wrap_sz = s.add_style :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: false,:horizontal => :center,:vertical => :center } sz_all = s.add_style :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :center,:vertical => :center } row_cell = s.add_style :bg_color=> "FAEBDC",:border => { :style => :thin, :color =>"000000" },alignment: {wrap_text: true,:horizontal => :center,:vertical => :center } - blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 20,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :center,:vertical => :center} + blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 25,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :center,:vertical => :center} #课堂信息摘要 wb.add_worksheet(name:course_info[0]) do |sheet| @@ -32,12 +32,12 @@ wb.styles do |s| sheet.sheet_view.show_grid_lines = false sheet_title = activity_level[1] sheet_content = activity_level[2] - sheet.add_row sheet_title, :style => blue_cell + sheet.add_row sheet_title, :height => 25,:style => blue_cell if sheet_content.count > 0 sheet_content.each_with_index do |c,index| c_1 = (index+1) c_2 = [c_1] + c.values - sheet.add_row c_2, :style => sz_all #用户id + sheet.add_row c_2, :height => 25, :style => sz_all #用户id end sheet.column_widths *([20]*sheet.column_info.count) sheet.column_info.first.width = 8 @@ -82,7 +82,7 @@ wb.styles do |s| sheet_content.each_with_index do |c,index| c_1 = (index+1) c_2 = [c_1] + c - sheet.add_row c_2, :style => sz_all #用户id + sheet.add_row c_2, :height => 25,:style => sz_all #用户id end end sheet.column_widths *([15]*sheet.column_info.count) @@ -100,7 +100,7 @@ wb.styles do |s| sheet.add_row head_title, :style => blue_cell if content_shixun.count > 0 content_shixun.each do |user| - sheet.add_row user, :style => sz_all + sheet.add_row user, :height => 25,:style => sz_all end #each_widh_index end sheet.column_widths *([20]*sheet.column_info.count) @@ -119,7 +119,7 @@ wb.styles do |s| sheet.add_row head_title, :style => blue_cell if content_.count > 0 content_.each do |user| - sheet.add_row user, :style => no_wrap_sz + sheet.add_row user, :height => 25,:style => no_wrap_sz end #each_widh_index end sheet.column_widths *([20]*sheet.column_info.count) @@ -138,7 +138,7 @@ wb.styles do |s| sheet.add_row head_title, :style => blue_cell if content_.count > 0 content_.each do |user| - sheet.add_row user, :style => sz_all + sheet.add_row user, :height => 25,:style => sz_all end #each_widh_index end sheet.column_widths *([20]*sheet.column_info.count) @@ -155,7 +155,7 @@ wb.styles do |s| content_ = task[2] sheet.add_row task[1], :style => blue_cell content_.each do |user| - sheet.add_row user, :style => sz_all + sheet.add_row user, :height => 25,:style => sz_all end #each_widh_index sheet.column_widths *([20]*sheet.column_info.count) sheet.column_info.first.width = 12 @@ -171,7 +171,7 @@ wb.styles do |s| content_ = ex[2] sheet.add_row ex[1], :style => blue_cell content_.each do |user| - sheet.add_row user, :style => sz_all #用户id + sheet.add_row user, :height => 25,:style => sz_all #用户id end #each_widh_index sheet.column_widths *([20]*sheet.column_info.count) sheet.column_info.first.width = 12 diff --git a/app/views/graduation_tasks/tasks_list.xlsx.axlsx b/app/views/graduation_tasks/tasks_list.xlsx.axlsx index 1f4f76292..e34290498 100644 --- a/app/views/graduation_tasks/tasks_list.xlsx.axlsx +++ b/app/views/graduation_tasks/tasks_list.xlsx.axlsx @@ -5,10 +5,12 @@ wb.styles do |s| blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 20,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {:horizontal => :center} wb.add_worksheet(:name =>"学生成绩") do |sheet| - sheet.add_row table_columns, :style => blue_cell + sheet.add_row table_columns,:height =>20, :style => blue_cell sheet.column_info.first.width = 12 task_users.each do |user| - sheet.add_row user, :style => sz_all + sheet.add_row user, :height =>20, :style => sz_all end #each_widh_index + sheet.column_widths *([25]*sheet.column_info.count) + sheet.column_info.first.width = 12 end #add_worksheet end \ No newline at end of file diff --git a/app/views/graduation_works/edit.json.jbuilder b/app/views/graduation_works/edit.json.jbuilder index 7fc3a9621..254579473 100644 --- a/app/views/graduation_works/edit.json.jbuilder +++ b/app/views/graduation_works/edit.json.jbuilder @@ -3,6 +3,8 @@ json.task_type @task.task_type json.work_id @work.id json.description @work.description json.user_name @task_user.real_name +json.max_num @task.max_num +json.min_num @task.min_num json.attachments @work.attachments do |atta| json.partial! "attachments/attachment_simple", locals: {attachment: atta, delete: @work.delete_atta(atta)} diff --git a/app/views/graduation_works/new.json.jbuilder b/app/views/graduation_works/new.json.jbuilder index 601ba02d3..26c046ab6 100644 --- a/app/views/graduation_works/new.json.jbuilder +++ b/app/views/graduation_works/new.json.jbuilder @@ -6,4 +6,6 @@ if @task.task_type == 2 json.user_id @user.id json.user_student_id @user.student_id json.group_name @course.course_member(@user.id).try(:course_group_name) + json.max_num @task.max_num + json.min_num @task.min_num end diff --git a/app/views/homework_commons/code_review_detail.json.jbuilder b/app/views/homework_commons/code_review_detail.json.jbuilder index 4ebabf20a..c33a906ec 100644 --- a/app/views/homework_commons/code_review_detail.json.jbuilder +++ b/app/views/homework_commons/code_review_detail.json.jbuilder @@ -2,18 +2,26 @@ json.course_id @course.id json.course_name @course.name json.homework_common_id @homework.id json.homework_common_name @homework.name +json.work_id @student_work.id json.work_name @student_work.name json.username @user.full_name json.user_id @user.id json.user_login @user.login json.work_score @student_work.work_score + if @student_work.ultimate_score json.adjust_score @student_work.work_score < 0 ? 0 : number_with_precision(@student_work.work_score, precision: 1) else json.final_score @student_work.final_score json.late_penalty @student_work.late_penalty json.score @student_work.work_score < 0 ? 0 : number_with_precision(@student_work.work_score, precision: 1) + if @homework.work_efficiency + json.eff_score_full number_with_precision @homework.eff_score, precision: 1 + json.eff_score number_with_precision @student_work.eff_score, precision: 1 + json.challenge_score_full number_with_precision (100 - @homework.eff_score), precision: 1 + json.challenge_score number_with_precision @student_work.final_score, precision: 1 + end end json.challenge_list do @@ -25,6 +33,7 @@ json.challenge_list do json.final_score challenge[:final_score] json.username challenge[:username] json.all_score challenge[:all_score] + json.copy_user_id challenge[:copy_user_id] json.copy_username challenge[:copy_username] json.copy_end_time challenge[:copy_end_time] json.code_rate challenge[:code_rate] diff --git a/app/views/student_works/adjust_review_score.json.jbuilder b/app/views/student_works/adjust_review_score.json.jbuilder index e69de29bb..928806bd6 100644 --- a/app/views/student_works/adjust_review_score.json.jbuilder +++ b/app/views/student_works/adjust_review_score.json.jbuilder @@ -0,0 +1,4 @@ +json.status 0 +json.message "调分成功" +json.work_score number_with_precision @work.work_score, 1 +json.challenge_score number_with_precision @work.final_score, 1 \ No newline at end of file diff --git a/app/views/student_works/shixun_work_report.json.jbuilder b/app/views/student_works/shixun_work_report.json.jbuilder index 1c6ed5899..e24092f05 100644 --- a/app/views/student_works/shixun_work_report.json.jbuilder +++ b/app/views/student_works/shixun_work_report.json.jbuilder @@ -1,6 +1,7 @@ json.homework_common_id @homework.id json.category @homework.category_info json.course_name @course.name +json.work_id @work.id if @shixun json.shixun_name @shixun.name # 总体评价 @@ -8,9 +9,15 @@ if @shixun json.myself_experience @work.myshixun.try(:total_score) json.total_experience @shixun.all_score json.work_score number_with_precision @work.work_score, precision: 1 - json.all_work_score 100 + json.all_work_score number_with_precision 100, precision: 1 json.time_consuming @work.myshixun_consume json.evaluate_count @user_evaluate_count.to_i + if @homework.work_efficiency + json.eff_score_full number_with_precision @homework.eff_score, precision: 1 + json.eff_score number_with_precision @work.eff_score, precision: 1 + json.challenge_score_full number_with_precision (100 - @homework.eff_score), precision: 1 + json.challenge_score number_with_precision @work.final_score, precision: 1 + end # 阶段成绩 json.stage_list do @@ -24,6 +31,10 @@ if @shixun json.myself_experience game.final_score json.experience game.challenge.all_score json.complete_status game_status(game, @homework) + json.challenge_id game.challenge_id + challenge_score = @homework.challenge_score game.challenge_id + json.game_score_full challenge_score + json.game_score @work.work_challenge_score game, challenge_score end end