修改评分列表获取方式
This commit is contained in:
parent
e0ff4ec949
commit
2628ab4808
|
@ -1,7 +1,7 @@
|
||||||
class HomeworkAttachController < ApplicationController
|
class HomeworkAttachController < ApplicationController
|
||||||
layout "course_base"
|
layout "course_base"
|
||||||
include CoursesHelper
|
include CoursesHelper
|
||||||
|
include HomeworkAttachHelper
|
||||||
helper :words
|
helper :words
|
||||||
###############################
|
###############################
|
||||||
before_filter :can_show_course,except: []
|
before_filter :can_show_course,except: []
|
||||||
|
@ -373,10 +373,20 @@ class HomeworkAttachController < ApplicationController
|
||||||
@offset ||= @feedback_pages.offset
|
@offset ||= @feedback_pages.offset
|
||||||
@jour = @jours[@offset, @limit]
|
@jour = @jours[@offset, @limit]
|
||||||
#@comprehensive_evaluation教师评论
|
#@comprehensive_evaluation教师评论
|
||||||
@comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1").order("created_on DESC")
|
#@comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1").order("created_on DESC")
|
||||||
|
teachers = searchTeacherAndAssistant @course
|
||||||
|
@comprehensive_evaluation = []
|
||||||
|
teachers.each do|teacher|
|
||||||
|
temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first
|
||||||
|
@comprehensive_evaluation << temp if temp
|
||||||
|
end
|
||||||
|
#@comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id in #{convert_array(teachers)}").order("created_on DESC")
|
||||||
#@anonymous_comments 匿评
|
#@anonymous_comments 匿评
|
||||||
@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2").order("created_on DESC")
|
#@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2").order("created_on DESC")
|
||||||
|
annymous_users = @homework.homework_evaluations.map(&:user)
|
||||||
|
unless annymous_users.nil? || annymous_users.count == 0
|
||||||
|
@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in #{convert_array(annymous_users)}").order("created_on DESC")
|
||||||
|
end
|
||||||
@totle_score = score_for_homework @homework
|
@totle_score = score_for_homework @homework
|
||||||
@teaher_score = teacher_score_for_homework @homework
|
@teaher_score = teacher_score_for_homework @homework
|
||||||
|
|
||||||
|
|
|
@ -90,4 +90,19 @@ module HomeworkAttachHelper
|
||||||
seems_rateable_rate = HomeworkAttach.find_by_sql("SELECT * FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{homework.id} AND rater_id = #{user.id}")
|
seems_rateable_rate = HomeworkAttach.find_by_sql("SELECT * FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{homework.id} AND rater_id = #{user.id}")
|
||||||
seems_rateable_rate.nil? || seems_rateable_rate.count == 0 ? 0:seems_rateable_rate[0].stars
|
seems_rateable_rate.nil? || seems_rateable_rate.count == 0 ? 0:seems_rateable_rate[0].stars
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def convert_array array
|
||||||
|
ary = "("
|
||||||
|
if array.nil? || array.count == 0
|
||||||
|
return "()"
|
||||||
|
end
|
||||||
|
array.each do |member|
|
||||||
|
if member == array.last
|
||||||
|
ary += member.to_s + ")"
|
||||||
|
else
|
||||||
|
ary += member.to_s + ","
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ary
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -79,11 +79,11 @@
|
||||||
<div id="ping_tb_" class="ping_tb_">
|
<div id="ping_tb_" class="ping_tb_">
|
||||||
<ul>
|
<ul>
|
||||||
<li id="ping_tb_4" class="ping_normaltab" onmouseover="i:HoverLi(4);">
|
<li id="ping_tb_4" class="ping_normaltab" onmouseover="i:HoverLi(4);">
|
||||||
<%= l(:label_teacher_comments) %>(<span class="c_red"><%= @comprehensive_evaluation.count == 0 ? 0:1 %></span>)</li>
|
<%= l(:label_teacher_comments) %>(<span class="c_red"><%= @comprehensive_evaluation.nil? ? 0 : @comprehensive_evaluation.count %></span>)</li>
|
||||||
<li id="ping_tb_5" class="ping_normaltab" onmouseover="i:HoverLi(5);">
|
<li id="ping_tb_5" class="ping_normaltab" onmouseover="i:HoverLi(5);">
|
||||||
<%= l(:label_anonymous_comments) %>(<span class="c_red"><%= @anonymous_comments.count %></span>)</li>
|
<%= l(:label_anonymous_comments) %>(<span class="c_red"><%= @anonymous_comments.nil? ? 0 : @anonymous_comments.count %></span>)</li>
|
||||||
<li id="ping_tb_3" class="ping_hovertab" onmouseover="x:HoverLi(3);">
|
<li id="ping_tb_3" class="ping_hovertab" onmouseover="x:HoverLi(3);">
|
||||||
<%= l(:label_responses) %>(<span class="c_red"><%= @jours.count %></span>)</li>
|
<%= l(:label_responses) %>(<span class="c_red"><%= @jours.nil? ? 0 : @jours.count %></span>)</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
@ -95,12 +95,12 @@
|
||||||
</div><!--全部评论end-->
|
</div><!--全部评论end-->
|
||||||
|
|
||||||
<div class="ping_undis" id="tbc_04">
|
<div class="ping_undis" id="tbc_04">
|
||||||
<% if @comprehensive_evaluation.count > 0 %>
|
<% @comprehensive_evaluation.nil? || @comprehensive_evaluation.count == 0 || @comprehensive_evaluation.each do |jour| %>
|
||||||
<%= render :partial => 'homework_attach/jour',:locals => {:jour => @comprehensive_evaluation.first} %>
|
<%= render :partial => 'homework_attach/jour',:locals => {:jour => jour} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="ping_undis" id="tbc_05">
|
<div class="ping_undis" id="tbc_05">
|
||||||
<%= @anonymous_comments.each do |jour| %>
|
<%= @anonymous_comments.nil? || @anonymous_comments.each do |jour| %>
|
||||||
<%= render :partial => 'homework_attach/jour',:locals => {:jour => jour} %>
|
<%= render :partial => 'homework_attach/jour',:locals => {:jour => jour} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue