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 %>