From eb551788ac7a535be352b9c276f4e28789d79c36 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 5 Nov 2014 09:16:06 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E5=8C=BF=E8=AF=84=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=9F=A5=E8=AF=A2=E4=B8=8D=E6=AD=A3=E7=A1=AE=202.?= =?UTF-8?q?=E5=8C=BF=E8=AF=84=E5=88=86=E9=85=8D=E6=94=AF=E6=8C=812?= =?UTF-8?q?=E4=BB=BD=E4=BD=9C=E4=B8=9A=E5=88=86=E9=85=8D=203.=E5=8C=BF?= =?UTF-8?q?=E8=AF=84=E5=88=86=E9=85=8D=E4=B8=8D=E6=AD=A3=E7=A1=AE=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 4 ++-- app/controllers/homework_attach_controller.rb | 2 +- app/views/bids/start_anonymous_comment.js.erb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 5146282ac..8da054d71 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -511,7 +511,7 @@ class BidsController < ApplicationController 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, - (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = 3123) AS m_score + (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id}) AS m_score 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 @@ -1006,7 +1006,7 @@ class BidsController < ApplicationController @bid = Bid.find(params[:id]) if(@bid.comment_status == 0) homeworks = @bid.homeworks - if(homeworks && homeworks.size > 2) + if(homeworks && homeworks.size >= 2) homeworks.each_with_index do |homework, index| user = homework.user n = 3 # TODO: this value should get from params, (老师设置) diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 12aa5860f..4b7fdb15e 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -103,7 +103,7 @@ class HomeworkAttachController < ApplicationController 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, - (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = 3123) AS m_score + (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id}) AS m_score 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 diff --git a/app/views/bids/start_anonymous_comment.js.erb b/app/views/bids/start_anonymous_comment.js.erb index c7e2bfb40..392e999a4 100644 --- a/app/views/bids/start_anonymous_comment.js.erb +++ b/app/views/bids/start_anonymous_comment.js.erb @@ -3,7 +3,7 @@ $("#<%= @bid.id %>_start_anonymous_comment").remove(); $("#<%= @bid.id %>_anonymous_comment").append('<%= link_to "关闭匿评", stop_anonymous_comment_bid_path(@bid), remote: true %>'); <% elsif @statue == 2 %> - alert('启动失败\n作业总数大于4份时才能启动匿评'); + alert('启动失败\n作业总数大于等于2份时才能启动匿评'); <% elsif @statue == 3%> alert("已开启匿评,请务重复开启"); <% end %>