diff --git a/app/helpers/homework_attach_helper.rb b/app/helpers/homework_attach_helper.rb
index c3bd240a3..8ba02136e 100644
--- a/app/helpers/homework_attach_helper.rb
+++ b/app/helpers/homework_attach_helper.rb
@@ -84,4 +84,10 @@ module HomeworkAttachHelper
def praise_homework_count obj_id
PraiseTread.where("praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'HomeworkAttach'").count
end
+
+ #获取用户对作业的评分
+ 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
+ end
end
\ No newline at end of file
diff --git a/app/views/homework_attach/_jour.html.erb b/app/views/homework_attach/_jour.html.erb
index 7e2bf8eee..06800084c 100644
--- a/app/views/homework_attach/_jour.html.erb
+++ b/app/views/homework_attach/_jour.html.erb
@@ -2,7 +2,11 @@
-
<%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%><%= jour.created_on %>评分:
+
<%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%>
+
<%= jour.created_on %>
+ <%= l(:label_work_rating) %>:
+ <%= render :partial => 'show_score', locals: {:stars => get_homework_score(jour.user,@homework ) } %>
+
<%= textilizable jour.notes%>
diff --git a/app/views/homework_attach/_show.html.erb b/app/views/homework_attach/_show.html.erb
index b23c98823..22b33fbec 100644
--- a/app/views/homework_attach/_show.html.erb
+++ b/app/views/homework_attach/_show.html.erb
@@ -52,10 +52,16 @@
<% if @is_comprehensive_evaluation == 3 %>
-
+ <%= l(:label_work_rating) %>:
+ <%= render :partial => 'show_score', locals: {:stars => @totle_score} %>
<% elsif @is_comprehensive_evaluation == 2 %>
<%= l(:label_work_rating) %>:
- <%= rating_for @homework, dimension: :quality, class: 'rateable div_inline' %>
+ <% if @has_evaluation || !can_anonymous_comments %>
+ <%= render :partial => 'show_score', locals: {:stars => @totle_score} %>
+ <% else %>
+ <%= 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' %>
diff --git a/app/views/homework_attach/show.js.erb b/app/views/homework_attach/show.js.erb
index 66ed277f2..5db0f1505 100644
--- a/app/views/homework_attach/show.js.erb
+++ b/app/views/homework_attach/show.js.erb
@@ -1,4 +1,4 @@
-$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show',:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework, :teaher_score => @teaher_score}) %>');
+$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show',:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework, :teaher_score => @teaher_score,:can_anonymous_comments => false}) %>');
showModal('ajax-modal', '503px');
$('#ajax-modal').css('height','569px');
diff --git a/db/schema.rb b/db/schema.rb
index 4585e20d6..aceb82069 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -178,6 +178,13 @@ ActiveRecord::Schema.define(:version => 20141102054414) do
add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
+ create_table "class_members", :force => true do |t|
+ t.integer "member_id"
+ t.integer "course_class_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "code_review_assignments", :force => true do |t|
t.integer "issue_id"
t.integer "change_id"
@@ -310,6 +317,14 @@ ActiveRecord::Schema.define(:version => 20141102054414) do
t.integer "container_id", :default => 0
end
+ create_table "course_classes", :force => true do |t|
+ t.string "name"
+ t.text "explain"
+ t.integer "course_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "course_infos", :force => true do |t|
t.integer "course_id"
t.integer "user_id"