作品列表中的已提交人数无法自动刷新

yuanke_cache
cxt 9 years ago
parent 572ad5a162
commit 06361246c7

@ -868,6 +868,7 @@ class StudentWorkController < ApplicationController
update_org_activity(@homework.class,@homework.id) update_org_activity(@homework.class,@homework.id)
if @work.save if @work.save
@work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => @work.id).first @work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => @work.id).first
@count = @homework.student_works.has_committed.count
respond_to do |format| respond_to do |format|
format.js format.js
end end

@ -2,7 +2,7 @@
<span class="c_dark f14 fb fl mr15"> <span class="c_dark f14 fb fl mr15">
作品 作品
<font class="f12 c_red"> <font class="f12 c_red">
(<%= @student_work_count%>人已交) (<span id="student_work_count"><%= @student_work_count%></span>人已交)
</font> </font>
<%# my_work = @homework.student_works.where("user_id = #{User.current.id}").first %> <%# my_work = @homework.student_works.where("user_id = #{User.current.id}").first %>
<% my_work = cur_user_works_for_homework @homework %> <% my_work = cur_user_works_for_homework @homework %>

@ -17,3 +17,5 @@ $("#score_list_<%= @work.id%>").removeAttr("style");
$("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work, :index => 1}) %>"); $("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work, :index => 1}) %>");
$("#work_num_<%= @work.id%>").html(num); $("#work_num_<%= @work.id%>").html(num);
<% end%> <% end%>
$("#student_work_count").html("<%=@count %>");

Loading…
Cancel
Save