作业修改
This commit is contained in:
parent
1314b2d07d
commit
47c8ffd22a
|
@ -84,4 +84,10 @@ module HomeworkAttachHelper
|
||||||
def praise_homework_count obj_id
|
def praise_homework_count obj_id
|
||||||
PraiseTread.where("praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'HomeworkAttach'").count
|
PraiseTread.where("praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'HomeworkAttach'").count
|
||||||
end
|
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
|
end
|
|
@ -2,7 +2,11 @@
|
||||||
<div class="ping_dispic"><a target="_blank" href="#"><%= image_tag(url_to_avatar(jour.user)) %></a></div>
|
<div class="ping_dispic"><a target="_blank" href="#"><%= image_tag(url_to_avatar(jour.user)) %></a></div>
|
||||||
<div class="ping_discon">
|
<div class="ping_discon">
|
||||||
<div class="ping_distop">
|
<div class="ping_distop">
|
||||||
<span><%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%></span><span style="color:#a6a6a6; margin-right:40px; margin-left:30px;"><%= jour.created_on %></span><span style="font-weight:bold; color:#a6a6a6; ">评分:<a href="#"></a><a href="#"></a><a href="#"></a><a href="#"></a><a href="#"></a></span>
|
<span><%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%></span>
|
||||||
|
<span style="color:#a6a6a6; margin-right:40px; margin-left:30px;"><%= jour.created_on %></span><span style="font-weight:bold; color:#a6a6a6; ">
|
||||||
|
<%= l(:label_work_rating) %>:
|
||||||
|
<%= render :partial => 'show_score', locals: {:stars => get_homework_score(jour.user,@homework ) } %>
|
||||||
|
</span>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<p><%= textilizable jour.notes%></p>
|
<p><%= textilizable jour.notes%></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -52,10 +52,16 @@
|
||||||
|
|
||||||
<div class="ping_star">
|
<div class="ping_star">
|
||||||
<% if @is_comprehensive_evaluation == 3 %>
|
<% if @is_comprehensive_evaluation == 3 %>
|
||||||
|
<%= l(:label_work_rating) %>:
|
||||||
|
<%= render :partial => 'show_score', locals: {:stars => @totle_score} %>
|
||||||
<% elsif @is_comprehensive_evaluation == 2 %>
|
<% elsif @is_comprehensive_evaluation == 2 %>
|
||||||
<%= l(:label_work_rating) %>:
|
<%= 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%>
|
<% elsif @is_comprehensive_evaluation == 1%>
|
||||||
<%= l(:label_work_rating) %>:
|
<%= l(:label_work_rating) %>:
|
||||||
<%= rating_for @homework, dimension: :quality, class: 'rateable div_inline' %>
|
<%= rating_for @homework, dimension: :quality, class: 'rateable div_inline' %>
|
||||||
|
|
|
@ -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');
|
showModal('ajax-modal', '503px');
|
||||||
$('#ajax-modal').css('height','569px');
|
$('#ajax-modal').css('height','569px');
|
||||||
|
|
||||||
|
|
15
db/schema.rb
15
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
|
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|
|
create_table "code_review_assignments", :force => true do |t|
|
||||||
t.integer "issue_id"
|
t.integer "issue_id"
|
||||||
t.integer "change_id"
|
t.integer "change_id"
|
||||||
|
@ -310,6 +317,14 @@ ActiveRecord::Schema.define(:version => 20141102054414) do
|
||||||
t.integer "container_id", :default => 0
|
t.integer "container_id", :default => 0
|
||||||
end
|
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|
|
create_table "course_infos", :force => true do |t|
|
||||||
t.integer "course_id"
|
t.integer "course_id"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
|
|
Loading…
Reference in New Issue