From e2c034dcefa6b392f08c0c7becceb5f4f33f156b Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 6 Nov 2014 11:58:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=B3=E9=97=AD=E5=8C=BF?= =?UTF-8?q?=E8=AF=84=E4=B9=8B=E5=90=8E=EF=BC=8C=E5=AD=A6=E7=94=9F=E5=8C=BF?= =?UTF-8?q?=E8=AF=84=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA=E4=B8=BA=E5=B7=B2?= =?UTF-8?q?=E8=AF=84=E5=88=97=E8=A1=A8=EF=BC=8C=E5=AD=A6=E7=94=9F=E8=AF=84?= =?UTF-8?q?=E5=88=86=E6=98=BE=E7=A4=BA=E4=B8=BA=E6=88=91=E7=9A=84=E8=AF=84?= =?UTF-8?q?=E5=88=86=20=E5=88=86=E6=95=B0=E6=98=BE=E7=A4=BA=E4=B8=BA?= =?UTF-8?q?=E6=88=91=E5=AF=B9=E8=AF=A5=E4=BD=9C=E4=B8=9A=E7=9A=84=E8=AF=84?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 3 ++- app/controllers/homework_attach_controller.rb | 3 ++- app/views/bids/_homework_list.html.erb | 2 +- app/views/homework_attach/_homework.html.erb | 6 +++--- config/locales/zh.yml | 3 ++- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index cab954e96..334bc3413 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -508,6 +508,7 @@ class BidsController < ApplicationController WHERE table1.t_score IS NULL") @cur_type = 1 else + m_score_null = @bid.comment_status == 2 ? "IS NOT NULL" : "IS NULL" all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM(SELECT homework_attaches.*, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id NOT IN #{teachers}) AS s_score, @@ -515,7 +516,7 @@ class BidsController < ApplicationController FROM homework_attaches INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id} ORDER BY s_score DESC) AS table1 - WHERE table1.m_score IS NULL") + WHERE table1.m_score #{m_score_null}") @is_student_batch_homework = true @cur_type = 4 end diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 42c7ffc77..6b311989e 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -98,6 +98,7 @@ class HomeworkAttachController < ApplicationController #获取学生匿评列表 def get_student_batch_homework + m_score_null = @bid.comment_status == 2 ? "IS NOT NULL" : "IS NULL" @is_student_batch_homework = true teachers = find_course_teachers @course all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM(SELECT homework_attaches.*, @@ -107,7 +108,7 @@ class HomeworkAttachController < ApplicationController FROM homework_attaches INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id} ORDER BY s_score DESC) AS table1 - WHERE table1.m_score IS NULL") + WHERE table1.m_score #{m_score_null}") @cur_page = params[:page] || 1 @cur_type = 4 @homework_list = paginateHelper all_homework_list,10 diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index 5421ed8d9..acbcbc2fa 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -29,7 +29,7 @@ <% else %>