From 41da5389dee3d1c5c19d86de98b8178889f3242a Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sat, 29 Jun 2019 09:07:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/graduation_tasks_controller.rb | 2 +- app/controllers/homework_commons_controller.rb | 11 +++++++---- app/controllers/student_works_controller.rb | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/controllers/graduation_tasks_controller.rb b/app/controllers/graduation_tasks_controller.rb index 93d3cba3d..454f23c81 100644 --- a/app/controllers/graduation_tasks_controller.rb +++ b/app/controllers/graduation_tasks_controller.rb @@ -122,7 +122,7 @@ class GraduationTasksController < ApplicationController @work_count = @work_list.count @work_excel = @work_list - @work_list = @work_list.page(page).limit(limit) + @work_list = @work_list.page(page).per(limit) respond_to do |format| format.json format.xlsx{ diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index bd18f102a..c3bd777ae 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -316,10 +316,13 @@ class HomeworkCommonsController < ApplicationController compelete_status = 1 end end - if setting_time.end_time > Time.now - work.update_attributes(:work_status => 1, :late_penalty => 0, :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id, :compelete_status => compelete_status) - else - work.update_attributes(:work_status => ((myshixun.is_complete? && (myshixun.done_time < setting_time.end_time)) ? 1 : 2), :late_penalty => (myshixun.is_complete? && (myshixun.done_time < setting_time.end_time) ? 0 : homework.late_penalty), :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id, :compelete_status => compelete_status) + games.each do |game| + unless game.nil? + pass_consume_time += (game.cost_time / 60.0).to_f + user_total_score += game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i + adjust_score = work.challenge_work_scores.where(:challenge_id => setting.challenge_id).last + final_score += adjust_score.present? ? adjust_score.score : (homework.homework_detail_manual.answer_open_evaluation ? setting.score : (game.final_score > 0 ? game.real_score(setting.score) : 0)) + end end end end diff --git a/app/controllers/student_works_controller.rb b/app/controllers/student_works_controller.rb index ab026cf05..5d14a43ea 100644 --- a/app/controllers/student_works_controller.rb +++ b/app/controllers/student_works_controller.rb @@ -43,7 +43,7 @@ class StudentWorksController < ApplicationController def search_member_list # 统一设置的作业取所有学生,否则取已发布的分班学生 students = @homework.unified_setting? ? @course.students : @course.students.where(course_group_id: @homework.published_settings.pluck(:course_group_id)) - unless params[:search].blank? + if !params[:search].blank? @members = students.joins(user: :user_extension).where("course_members.user_id != #{current_user.id} and (concat(users.lastname, users.firstname) like ? or user_extensions.student_id like ?)", "%#{params[:search]}%", "%#{params[:search]}%") else