1.匿评作业列表我的分数显示不正确

2.学生可多次进行匿评评分
This commit is contained in:
sw 2014-11-08 13:43:29 +08:00
parent c68e68af96
commit e0d85f72a1
3 changed files with 5 additions and 9 deletions

View File

@ -508,15 +508,13 @@ 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.*,
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("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 = #{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
WHERE table1.m_score #{m_score_null}")
WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id} ORDER BY s_score DESC")
@is_student_batch_homework = true
@cur_type = 4
end

View File

@ -98,17 +98,15 @@ 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.*,
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("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 = #{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
WHERE table1.m_score #{m_score_null}")
WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id} ORDER BY s_score DESC")
@cur_page = params[:page] || 1
@cur_type = 4
@homework_list = paginateHelper all_homework_list,10

View File

@ -35,7 +35,7 @@
<li class="wscore">
<%= is_student_batch_homework ? l(:label_my_score) : l(:label_student_score)%>:
<span class="c_red">
<%= homework.s_score.nil? ? l(:label_without_score) : format("%.2f",(is_student_batch_homework ? (homework.m_score.nil? ? 0 : homework.m_score) : (homework.s_score.nil? ? 0 : homework.s_score))) %>
<%= is_student_batch_homework ? (homework.m_score.nil? ? l(:label_without_score) : homework.m_score) : (homework.s_score.nil? ? l(:label_without_score) : homework.s_score)%>
</span>
</li>
<% if is_teacher %>