1、部分星星显示不正确问题,2、评分初始值设置为0

This commit is contained in:
z9hang 2014-11-06 16:52:29 +08:00
parent 0d31ec53b5
commit 9b4e9bd04a
4 changed files with 19 additions and 18 deletions

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 : homework.s_score)) %>
<%= homework.s_score.nil? ? l(:label_without_score) : format("%.2f",((is_student_batch_homework ? homework.m_score : homework.s_score).nil? ? 0:(is_student_batch_homework ? homework.m_score : homework.s_score))) %>
</span>
</li>
<% if is_teacher %>

View File

@ -1,6 +1,6 @@
<span class="user" style="font-size: 15px">
<div data-kls="HomeworkAttach" data-id="2" data-dimension="quality" data-average="3.25" class="rateable div_inline jDisabled"
style="height: 20px; width: 100px; overflow: hidden; z-index: 1; position: relative;">
style="height: 20px; width: 115px; overflow: hidden; z-index: 1; position: relative;">
<% if stars != nil %>
<div class="jRatingColor" style="width: <%=stars.to_f * 20 %>%;"></div>
<% else %>

View File

@ -1,15 +1,15 @@
<% if is_comprehensive_evaluation == 3 || User.current == homework.user%>
<!-- <#%= l(:label_work_rating) %>
<%#= render :partial => 'show_score', locals: {:stars => totle_score} %> -->
<% elsif is_comprehensive_evaluation == 2 %>
<% if has_evaluation %>
<% else %>
<%= l(:label_work_rating) %>
<%= rating_for homework, dimension: :quality, class: 'rateable div_inline' %>
<% end %>
<% elsif @is_comprehensive_evaluation == 1%>
<%= l(:label_work_rating) %>
<%= rating_for homework, dimension: :quality, class: 'rateable div_inline' %>
<% if is_comprehensive_evaluation == 3 || User.current == homework.user%>
<!-- <#%= l(:label_work_rating) %>
<%#= render :partial => 'show_score', locals: {:stars => totle_score} %> -->
<% elsif is_comprehensive_evaluation == 2 %>
<% if has_evaluation %>
<% else %>
<%= l(:label_work_rating) %>
<%= rating_for homework, dimension: :quality,start_score: 0, class: 'rateable div_inline' %>
<% end %>
<% elsif @is_comprehensive_evaluation == 1%>
<%= l(:label_work_rating) %>
<%= rating_for homework, dimension: :quality,start_score: 0, class: 'rateable div_inline' %>
<% end %>

View File

@ -7,10 +7,11 @@ module SeemsRateable
:dimension => nil,
:static => false,
:class => 'rateable',
:id => nil
:id => nil,
:start_score => nil
}.update(opts)
content_tag :div, "", "data-average" => obj.average(options[:dimension]) ? obj.average(options[:dimension]).avg : 0, :id => options[:id],
content_tag :div, "", "data-average" => options[:start_score].nil? ? (obj.average(options[:dimension]) ? obj.average(options[:dimension]).avg : 0):options[:start_score], :id => options[:id],
:class => "#{options[:class]}#{jdisabled?(options[:static])}",
"data-id" => obj.id, "data-kls" => obj.class.name, "data-dimension" => options[:dimension]
end