班级作业:修改评分后,同一人的之前的评分,就不显示了
This commit is contained in:
parent
c9db4d6bba
commit
6f1c648770
|
@ -691,7 +691,7 @@ class StudentWorkController < ApplicationController
|
||||||
def show
|
def show
|
||||||
@score = student_work_score @work,User.current
|
@score = student_work_score @work,User.current
|
||||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||||
@student_work_scores = @work.student_works_scores.order("updated_at desc")
|
@student_work_scores = student_work_score_record(@work)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
|
@ -854,6 +854,7 @@ class StudentWorkController < ApplicationController
|
||||||
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
|
@count = @homework.student_works.has_committed.count
|
||||||
|
@student_work_scores = student_work_score_record @work
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
|
|
|
@ -69,6 +69,15 @@ module StudentWorkHelper
|
||||||
str
|
str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#获取学生作品的评分记录:同一个教师或教辅只显示最后一次评分
|
||||||
|
def student_work_score_record work
|
||||||
|
sql = "SELECT MAX(id) id FROM student_works_scores WHERE (reviewer_role = 2 OR reviewer_role = 1) AND score IS NOT NULL AND student_work_id = #{work.id} GROUP BY user_id"
|
||||||
|
tea_ts_ids = StudentWorksScore.find_by_sql sql
|
||||||
|
tea_ts_ids = tea_ts_ids.empty? ? "(-1)" : "(" + tea_ts_ids.map{|tea| tea.id}.join(",") + ")"
|
||||||
|
scores = work.student_works_scores.where("score IS NULL or reviewer_role = 3 or id in #{tea_ts_ids}").order("updated_at desc")
|
||||||
|
return scores
|
||||||
|
end
|
||||||
|
|
||||||
#获取赞的总数
|
#获取赞的总数
|
||||||
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 = 'StudentWork'").count
|
PraiseTread.where("praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'StudentWork'").count
|
||||||
|
|
|
@ -106,12 +106,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
|
||||||
<div class="ping_box fl" id="score_list_<%= work.id%>" style="<%= work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
|
<div class="ping_box fl" id="score_list_<%= work.id%>" style="<%= student_work_scores.empty? ? 'padding:0px;' : ''%>">
|
||||||
<%student_work_scores.each do |student_score|%>
|
<%= render :partial => 'student_work_score_records', :locals => {:student_work_scores => student_work_scores, :is_member_work => false} %>
|
||||||
<div id="work_score_<%= student_score.id%>">
|
|
||||||
<%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%>
|
|
||||||
</div>
|
|
||||||
<% end%>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<!---ping_box end--->
|
<!---ping_box end--->
|
||||||
|
|
|
@ -109,15 +109,8 @@
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class="ping_box fl" id="score_list_<%= work.id%>" style="<%= work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
|
<div class="ping_box fl" id="score_list_<%= work.id%>" style="<%= student_work_scores.empty? ? 'padding:0px;' : ''%>">
|
||||||
<%student_work_scores.each do |student_score|%>
|
<%= render :partial => 'student_work_score_records', :locals => {:student_work_scores => student_work_scores, :is_member_work => is_member_work} %>
|
||||||
<div id="work_score_<%= student_score.id%>">
|
|
||||||
<%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%>
|
|
||||||
</div>
|
|
||||||
<% end%>
|
|
||||||
<% if is_member_work && student_work_scores.empty? && !@is_teacher %>
|
|
||||||
<p class="c_red" style="text-align: center">暂无评分</p>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<!---ping_box end--->
|
<!---ping_box end--->
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
<% unless work.nil? %>
|
<% unless work.nil? %>
|
||||||
location.hash = "<%=work.id %>";
|
location.hash = "<%=work.id %>";
|
||||||
<% if @homework.homework_type == 2 %>
|
<% if @homework.homework_type == 2 %>
|
||||||
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>");
|
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => student_work_score_record(work),:is_focus => @is_focus}) %>");
|
||||||
|
|
||||||
var program_name = "text/x-csrc";
|
var program_name = "text/x-csrc";
|
||||||
var language = <%= @homework.language %>;
|
var language = <%= @homework.language %>;
|
||||||
|
@ -100,9 +100,9 @@
|
||||||
value: $("#work-src_<%= work.id%>").text()
|
value: $("#work-src_<%= work.id%>").text()
|
||||||
});
|
});
|
||||||
<% elsif @homework.homework_type == 1 %>
|
<% elsif @homework.homework_type == 1 %>
|
||||||
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>");
|
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => student_work_score_record(work),:is_focus => @is_focus}) %>");
|
||||||
<% elsif @homework.homework_type == 3 %>
|
<% elsif @homework.homework_type == 3 %>
|
||||||
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>");
|
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => student_work_score_record(work),:is_focus => @is_focus}) %>");
|
||||||
<% end %>
|
<% end %>
|
||||||
$('#score_<%= work.id%>').peSlider({range: 'min'});
|
$('#score_<%= work.id%>').peSlider({range: 'min'});
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
<%student_work_scores.each do |student_score|%>
|
||||||
|
<div id="work_score_<%= student_score.id%>">
|
||||||
|
<%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%>
|
||||||
|
</div>
|
||||||
|
<% end%>
|
||||||
|
<% if is_member_work && student_work_scores.empty? && !@is_teacher %>
|
||||||
|
<p class="c_red" style="text-align: center">暂无评分</p>
|
||||||
|
<% end %>
|
|
@ -1,12 +1,14 @@
|
||||||
$("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'add_score',:locals => {:work => @work,:score => @new_score}) %>");
|
$("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'add_score',:locals => {:work => @work,:score => @new_score}) %>");
|
||||||
$('#score_<%= @work.id%>').peSlider({range: 'min'});
|
$('#score_<%= @work.id%>').peSlider({range: 'min'});
|
||||||
|
|
||||||
<% if @is_new%>
|
<%# if @is_new%>
|
||||||
$("#score_list_<%= @work.id%>").prepend("<div id='work_score_<%= @new_score.id%>'><%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @new_score,:is_last => @is_last_a}) %></div>");
|
//$("#score_list_<%#= @work.id%>").prepend("<div id='work_score_<%#= @new_score.id%>'><%#= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @new_score,:is_last => @is_last_a}) %></div>");
|
||||||
<% else %>
|
<%# else %>
|
||||||
$("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @new_score,:is_last => @is_last}) %>");
|
//$("#work_score_<%#= @score.id%>").html("<%#= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @new_score,:is_last => @is_last}) %>");
|
||||||
<% end%>
|
<%# end%>
|
||||||
|
|
||||||
|
<% is_member_work = @homework.homework_type == 3 && @work.student_work_projects.empty? %>
|
||||||
|
$("#score_list_<%= @work.id%>").replaceWith("<%=escape_javascript(render :partial => 'student_work_score_records', :locals => {:student_work_scores => @student_work_scores, :is_member_work => is_member_work}) %>");
|
||||||
var num = $("#work_num_<%= @work.id%>").html();
|
var num = $("#work_num_<%= @work.id%>").html();
|
||||||
$("#score_list_<%= @work.id%>").removeAttr("style");
|
$("#score_list_<%= @work.id%>").removeAttr("style");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue