1、打分后作品的各项得分数据刷新

2、作品列表样式调整
This commit is contained in:
sw 2015-05-27 17:32:14 +08:00
parent 52834d8fa9
commit 4783bad924
6 changed files with 76 additions and 42 deletions

View File

@ -94,8 +94,34 @@ class StudentWorkController < ApplicationController
render_attachment_warning_if_needed(@score)
if @score.save
respond_to do |format|
format.js
case @score.reviewer_role
when 1 #教师评分:最后一个教师评分为最终评分
@work.teacher_score = @score.score
@work.final_score = @score.score
when 2 #教辅评分 教辅评分显示平均分
@work.teaching_asistant_score = @work.student_works_scores.where(:reviewer_role => 2).average(:score).try(:round, 2).to_f
if @work.teacher_score.nil?
if @work.student_score.nil?
@work.final_score = @work.teaching_asistant_score
else
@work.final_score = format("%.2f",@work.teaching_asistant_score * @homework.homework_detail_manual.ta_proportion + @work.student_score * (1 - @homework.homework_detail_manual.ta_proportion))
end
end
when 3 #学生评分 学生评分显示平均分
@work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f
if @work.teacher_score.nil?
if @work.teaching_asistant_score.nil?
@work.final_score = @work.student_score
else
@work.final_score = format("%.2f",@work.teaching_asistant_score * @homework.homework_detail_manual.ta_proportion + @work.student_score * (1 - @homework.homework_detail_manual.ta_proportion))
end
end
end
if @work.save
respond_to do |format|
format.js
end
end
end
end

View File

@ -0,0 +1,36 @@
<!--class=""-->
<ul class="hwork_ul <%= cycle("b_grey", "") %>" id="student_work_<%= student_work.id%>">
<li >
<%= link_to student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id,user_path(student_work.user),:class => "c_blue02 hwork_center"%>
</li>
<li>
<%= link_to student_work.user.show_name,user_path(student_work.user),:class => "c_blue02 hwork_name"%>
</li>
<li class=" hwork_tit">
<%= link_to student_work.name, student_work_path(student_work),:remote => true%>
</li>
<li class=" hwork_code <%= student_work.teacher_score.nil? ? 'c_grey' : 'c_red'%>">
<%= student_work.teacher_score.nil? ? "--" : format("%.2f",student_work.teacher_score)%>
</li>
<li class=" hwork_code <%= student_work.teaching_asistant_score.nil? ? 'c_grey' : 'c_red'%>">
<%= student_work.teaching_asistant_score.nil? ? "--" : format("%.2f",student_work.teaching_asistant_score)%>
</li>
<li class=" hwork_code02 <%= student_work.student_score.nil? ? 'c_grey' : 'c_red'%> student_score_info">
<%= student_work.student_score.nil? ? "--" : format("%.2f",student_work.student_score)%>
<% unless student_work.student_score.nil?%>
<span class="c_blue">
(<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>)
</span>
<div class="info_ni">
现共有
<span class="c_red">&nbsp;<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>&nbsp;</span>
名学生进行了匿评,平均分为
<span class="c_red">&nbsp;<%= format("%.2f",student_work.student_score)%>&nbsp;</span>分。
</div>
<% end%>
</li>
<li class=" hwork_code02 <%= student_work.final_score.nil? ? 'c_grey' : 'c_red'%>">
<%= student_work.final_score.nil? ? "--" : format("%.2f",student_work.final_score)%>
</li>
<div class="cl"></div>
</ul><!---hwork_ul end-->

View File

@ -6,3 +6,5 @@ $('#score_<%= @work.id%>').peSlider({range: 'min'});
<% else %>
$("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>");
<% end%>
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'student_work',:locals => {:student_work => @work}) %>");

View File

@ -63,11 +63,11 @@
<a href="javascript:void(0);" class="c_dark f14 fb fl ">教辅评分</a>
<a href="javascript:void(0);" class=" st_up " ></a>
</li>
<li class="w40 mr5">
<li class="w60 mr5 ml10">
<a href="javascript:void(0);" class="c_dark f14 fb fl ">匿评</a>
<a href="javascript:void(0);" class=" st_up " ></a>
</li>
<li class="w40">
<li class="w40 ml10">
<a href="javascript:void(0);" class="c_dark f14 fb fl ">成绩</a>
<a href="javascript:void(0);" class=" st_up " ></a>
</li>
@ -75,37 +75,7 @@
<div class="cl"></div>
<% @stundet_works.each do |student_work|%>
<!--class=""-->
<ul class="hwork_ul <%= cycle("b_grey", "") %>" >
<li >
<%= link_to student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id,user_path(student_work.user),:class => "c_blue02 hwork_center"%>
</li>
<li>
<%= link_to student_work.user.show_name,user_path(student_work.user),:class => "c_blue02 hwork_name"%>
</li>
<li class=" hwork_tit">
<%= link_to student_work.name, student_work_path(student_work),:remote => true%>
</li>
<li class=" hwork_code c_red">
<%= format("%.2f",student_work.teacher_score)%>
</li>
<li class=" hwork_code c_red">
<%= format("%.2f",student_work.teaching_asistant_score)%>
</li>
<li class=" hwork_code02 c_red student_score_info">
<%= format("%.2f",student_work.student_score)%><span class="c_blue">(3)</span>
<div class="info_ni">
现共有
<span class="c_red">&nbsp;3&nbsp;</span>
名学生进行了匿评,平均分为
<span class="c_red">&nbsp;100&nbsp;</span>分。
</div>
</li>
<li class=" hwork_code02 c_red">
<%= format("%.2f",student_work.final_score)%>
</li>
<div class="cl"></div>
</ul><!---hwork_ul end-->
<%= render :partial => 'student_work',:locals => {:student_work => student_work}%>
<div id="about_hwork_<%= student_work.id%>" ></div>
<% end%>

View File

@ -5,10 +5,10 @@ class CreateStudentWorks < ActiveRecord::Migration
t.text :description
t.integer :homework_common_id
t.integer :user_id
t.float :final_score, default: 0
t.float :teacher_score, default: 0
t.float :student_score, default: 0
t.float :teaching_asistant_score, default: 0
t.float :final_score
t.float :teacher_score
t.float :student_score
t.float :teaching_asistant_score
t.integer :project_id, default: 0
t.timestamps

View File

@ -634,10 +634,10 @@ a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
.w300{ width:300px;}
.w80{ width:80px;}
.t_c{ text-align:center;}
.hwork_tit{ width:295px; float:left; }
.hwork_tit a{ width:285px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; }
.hwork_tit{ width:240px; float:left; }
.hwork_tit a{ width:255px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; }
.hwork_code{ width:60px; text-align:center; margin-right:15px;}
.hwork_code02{ width:32px; text-align:center; margin-right:10px;}
.hwork_code02{ width:60px; text-align:center; margin-right:10px;}
a.hwork_center{ display:block; width:60px; text-align:center; margin-right:5px;}
a.hwork_name{ display:block;width:65px; text-align:center; margin-right:10px;}
.show_hwork{ border:2px solid #64bdd9; width:646px; padding:10px; color:#666666; padding-bottom:0px; }