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