From d9c3103e6ed7c7b76b4544d4e3cb722da3c6dedf Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 2 Dec 2014 16:55:16 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E7=95=99=E8=A8=80=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=BE=97=E5=88=86=E6=98=BE=E7=A4=BA=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=202.=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=AF=B9=E4=BD=9C=E4=B8=9A=E8=AF=84=E5=88=86?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/homework_attach_helper.rb | 4 ++-- app/views/homework_attach/_histoey_new.html.erb | 1 - app/views/homework_attach/_jour.html.erb | 14 +++++++++----- .../homework_attach/_show_static_star.html.erb | 5 +++++ 4 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 app/views/homework_attach/_show_static_star.html.erb diff --git a/app/helpers/homework_attach_helper.rb b/app/helpers/homework_attach_helper.rb index 63332e564..1ab1cb928 100644 --- a/app/helpers/homework_attach_helper.rb +++ b/app/helpers/homework_attach_helper.rb @@ -87,8 +87,8 @@ module HomeworkAttachHelper #获取用户对作业的评分 def get_homework_score user, homework - 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 + temp = HomeworkAttach.find_by_sql("SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{homework.id} AND rater_id = #{user.id}").first + @m_score = temp.nil? ? 0:temp.stars.to_i end def convert_array array diff --git a/app/views/homework_attach/_histoey_new.html.erb b/app/views/homework_attach/_histoey_new.html.erb index 183eb067d..5912d04cb 100644 --- a/app/views/homework_attach/_histoey_new.html.erb +++ b/app/views/homework_attach/_histoey_new.html.erb @@ -14,7 +14,6 @@
<%= render :partial => 'homework_attach/jour',:locals => {:jours => @jour,:show_score => false,:show_name => true,:is_jour => true} %>
-
<%= render :partial => 'homework_attach/jour',:locals => {:jours => @comprehensive_evaluation,:show_score => true,:show_name => true,:is_jour => false} %>
diff --git a/app/views/homework_attach/_jour.html.erb b/app/views/homework_attach/_jour.html.erb index fe2eca8dc..0e33e12c1 100644 --- a/app/views/homework_attach/_jour.html.erb +++ b/app/views/homework_attach/_jour.html.erb @@ -11,18 +11,22 @@
<% if show_name %> - <%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%> + <%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:5px; background:none;", :target => "_blank"%> <% else%> - <%= l(:label_anonymous) %> + <%= l(:label_anonymous) %> <% end %> - <%= format_time(jour.created_on) %> - + <%= format_time(jour.created_on) %> + <% if show_score %> <%= l(:label_work_rating) %>: - <%= render :partial => 'homework_attach/show_score', locals: {:stars => get_homework_score(jour.user,@homework ) } %> +
+ <% star = get_homework_score(jour.user,@homework)%> + <%= render :partial => 'homework_attach/show_static_star', :locals => {:start_score => star } %> +
+ <% end %>
diff --git a/app/views/homework_attach/_show_static_star.html.erb b/app/views/homework_attach/_show_static_star.html.erb new file mode 100644 index 000000000..7fe3edf22 --- /dev/null +++ b/app/views/homework_attach/_show_static_star.html.erb @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file