From 9b4e9bd04a3a12c00906815ed9e2e5cccc0b0d28 Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 6 Nov 2014 16:52:29 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E9=83=A8=E5=88=86=E6=98=9F=E6=98=9F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=8D=E6=AD=A3=E7=A1=AE=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C2=E3=80=81=E8=AF=84=E5=88=86=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=80=BC=E8=AE=BE=E7=BD=AE=E4=B8=BA0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_attach/_homework.html.erb | 2 +- .../homework_attach/_show_score.html.erb | 2 +- app/views/homework_attach/_show_star.html.erb | 28 +++++++++---------- .../lib/seems_rateable/helpers.rb | 5 ++-- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/app/views/homework_attach/_homework.html.erb b/app/views/homework_attach/_homework.html.erb index 0fb865884..ee28a14dc 100644 --- a/app/views/homework_attach/_homework.html.erb +++ b/app/views/homework_attach/_homework.html.erb @@ -35,7 +35,7 @@
  • <%= is_student_batch_homework ? l(:label_my_score) : l(:label_student_score)%>: - <%= 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))) %>
  • <% if is_teacher %> diff --git a/app/views/homework_attach/_show_score.html.erb b/app/views/homework_attach/_show_score.html.erb index 9e7586c38..2c9f60d92 100644 --- a/app/views/homework_attach/_show_score.html.erb +++ b/app/views/homework_attach/_show_score.html.erb @@ -1,6 +1,6 @@
    + style="height: 20px; width: 115px; overflow: hidden; z-index: 1; position: relative;"> <% if stars != nil %>
    <% else %> diff --git a/app/views/homework_attach/_show_star.html.erb b/app/views/homework_attach/_show_star.html.erb index 08923a874..b10455f1a 100644 --- a/app/views/homework_attach/_show_star.html.erb +++ b/app/views/homework_attach/_show_star.html.erb @@ -1,15 +1,15 @@ -<% if is_comprehensive_evaluation == 3 || User.current == homework.user%> - -<% 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%> + +<% 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 %> \ No newline at end of file diff --git a/lib/seems_rateable/lib/seems_rateable/helpers.rb b/lib/seems_rateable/lib/seems_rateable/helpers.rb index 3d79adf79..a0da7d0c9 100644 --- a/lib/seems_rateable/lib/seems_rateable/helpers.rb +++ b/lib/seems_rateable/lib/seems_rateable/helpers.rb @@ -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