分组作业的页面显示和评分处理调整

This commit is contained in:
cxt 2016-11-04 16:10:13 +08:00
parent a9265f3b35
commit d762c68f7b
13 changed files with 88 additions and 112 deletions

View File

@ -829,22 +829,22 @@ class StudentWorkController < ApplicationController
case @new_score.reviewer_role
when 1 #教师评分:最后一个教师评分为最终评分
@work.teacher_score = @new_score.score
if @is_group_leader
add_score_to_member @work, @homework, 1, 'teacher_score', @new_score.score
if @is_group_leader && params[:same_score]
add_score_to_member @work, @homework, @new_score
end
when 2 #教辅评分 教辅评分显示平均分
#@work.teaching_asistant_score = @work.student_works_scores.where(:reviewer_role => 2).average(:score).try(:round, 2).to_f
ts_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{@work.id} AND reviewer_role = 2 AND score IS NOT NULL ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
@work.teaching_asistant_score = ts_score.first.score.nil? ? nil : ts_score.first.score.try(:round, 2).to_f
if @is_group_leader
add_score_to_member @work, @homework, 2, 'teaching_asistant_score', @work.teaching_asistant_score
if @is_group_leader && params[:same_score]
add_score_to_member @work, @homework, @new_score
end
when 3 #学生评分 学生评分显示平均分
#@work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f
stu_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{@work.id} AND reviewer_role = 3 ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
@work.student_score = stu_score.first.score.try(:round, 2).to_f
if @is_group_leader
add_score_to_member @work, @homework, 3, 'student_score', @work.student_score
add_score_to_member @work, @homework, @new_score
end
end
@homework.update_column('updated_at', Time.now)

View File

@ -175,12 +175,19 @@ module StudentWorkHelper
return student_works
end
def add_score_to_member student_work, homework, role, score_type, score
def add_score_to_member student_work, homework, new_score
student_works = group_student_works student_work, homework
student_works.each do |st_work|
if st_work.student_works_scores.where("reviewer_role = #{role} and score is not null").empty?
st_work.update_attribute("#{score_type}", score)
st_work.student_works_scores << StudentWorksScore.create(:user_id => new_score.user_id, :score => new_score.score, :reviewer_role => new_score.reviewer_role, :comment => new_score.comment)
if new_score.reviewer_role == 1
st_work.teacher_score = new_score.score
elsif new_score.reviewer_role == 2
ts_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{st_work.id} AND reviewer_role = 2 AND score IS NOT NULL ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
st_work.teaching_asistant_score = ts_score.first.score.nil? ? nil : ts_score.first.score.try(:round, 2).to_f
else
st_work.student_score = student_work.student_score
end
st_work.save
end
end
end

View File

@ -11,6 +11,9 @@
<span class="ml5">分</span>
<span id="score_notice_span_<%= work.id%>" class="ml5 c_red" style="display: none;">未评分</span>
<div class="cl"></div></li>
<% if @is_teacher && work.homework_common.homework_type == 3 && !is_member_work %>
<label class="ml30"><input type="checkbox" class="mb10" name="same_score" id="same_score_<%= work.id%>" value="1"/>&nbsp;&nbsp;组员同评(同时给每个组员相同的得分)</label>
<% end %>
<li >
<% if @is_teacher%> <!-- 老师才可以上传批阅结果 -->
<span class="tit_fb"> 批阅结果:</span>

View File

@ -3,8 +3,6 @@
<div class="syllabus_courses_list" id="student_work_<%= student_work.id%>" style="cursor: default; background-color:#f6f6f6;">
<%= render :partial => 'evaluation_un_group_work', :locals => {:student_work => student_work} %>
</div>
<div id="about_hwork_<%= student_work.id %>" class="about_hwork"></div>
<div id="group_member_work_<%= student_work.id%>">
<%= render :partial => 'group_member_work', :locals => {:student_work => student_work} %>
</div>

View File

@ -2,30 +2,30 @@
<% is_expand = st.student_work_projects.empty? %>
<ul id="syllabus_course_ul">
<li class="syllabus_class_list" style="line-height:44px; vertical-align:middle;">
<div class="syllabus_class_w fontGrey3" style="<%=!is_expand ? '' : 'cursor: pointer;' %>" <%= !is_expand ? '' : "onclick = "+"show_student_work('"+"#{student_work_path(st)}"+"')" %>>
<div class="syllabus_class_w fontGrey3" style="cursor: pointer;" onclick="show_student_work('<%= student_work_path(st)%>')">
<%= link_to(image_tag(url_to_avatar(st.user),:width =>"40",:height => "40", :style => "display:block;"),user_activities_path(st.user), :class => "fl") %>
<% if !is_expand %>
<span class="fl student_work_<%= st.id%>" style="width:105px;">
<span class="fl hidden ml5" style="max-width:60px;"><%= st.user.show_name %></span>
<span class="fl student_work_<%= st.id%>" style="width:120px;">
<span class="fl hidden ml5" style="max-width:75px;"><%= st.user.show_name %></span>
<span class="fl">(组长)</span>
</span>
<span class="fl hidden student_work_<%= st.id%>" style="width:90px; margin-right:3px;">
<span class="fontGrey2">学号</span><%= st.user.user_extensions.nil? ? "--" : st.user.user_extensions.student_id%>
<span class="fl hidden student_work_<%= st.id%>" style="width:105px; text-align: center">
<%= st.user.user_extensions.student_id.nil? || st.user.user_extensions.student_id == "" ? "--" : st.user.user_extensions.student_id%>
</span>
<% else %>
<span class="fl student_work_<%= st.id%>" style="width:105px;">
<span class="fl hidden ml5" style="max-width:60px;"><%= st.user.show_name %></span>
<span class="fl student_work_<%= st.id%>" style="width:120px;">
<span class="fl hidden ml5" style="max-width:75px;"><%= st.user.show_name %></span>
</span>
<span class="fl student_work_<%= st.id%> hidden" style="width:90px; margin-right:3px;">
<span class="fontGrey2">学号</span><%= st.user.user_extensions.nil? ? "--" : st.user.user_extensions.student_id%>
<span class="fl student_work_<%= st.id%> hidden" style="width:105px; text-align: center">
<%= st.user.user_extensions.student_id.nil? ? "--" : st.user.user_extensions.student_id%>
</span>
<% end %>
<div class="flex-container fl" style="width:376px;">
<div class="flex-cell student_work_<%= st.id%>"><span class="<%= score_color st.teacher_score%> ml35"><%= st.teacher_score.nil? ? "--" : format("%.1f",st.teacher_score)%></span></div>
<div class="flex-cell student_work_<%= st.id%>"><span class="<%= score_color st.teaching_asistant_score%> ml35"><%= st.teaching_asistant_score.nil? ? "--" : format("%.1f",st.teaching_asistant_score)%></span></div>
<div class="flex-container fl" style="width:340px;">
<div class="flex-cell student_work_<%= st.id%>"><span class="<%= score_color st.teacher_score%>"><%= st.teacher_score.nil? ? "--" : format("%.1f",st.teacher_score)%></span></div>
<div class="flex-cell student_work_<%= st.id%>"><span class="<%= score_color st.teaching_asistant_score%>"><%= st.teaching_asistant_score.nil? ? "--" : format("%.1f",st.teaching_asistant_score)%></span></div>
<% if @homework.anonymous_comment == 0 %>
<div class="flex-cell student_work_<%= st.id%>">
<div class="<%= score_color st.student_score%> student_score_info ml35 pr">
<div class="<%= score_color st.student_score%> student_score_info pr">
<% if st.student_score.nil? %>
<span title="该作品未被匿评">未参与</span>
<% else %>
@ -47,7 +47,7 @@
<% end %>
<div class="flex-cell">
<% score = st.work_score %>
<div class="<%= score_color score%> student_final_scor_info ml35 pr" style="display: inline">
<div class="<%= score_color score%> student_final_scor_info pr" style="display: inline">
<%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
<% unless score.nil?%>
<div class="score-tip none tl" style="line-height: 18px; top:-32px; right:-233px;">
@ -70,11 +70,9 @@
</div>
</div>
</div>
<% if is_expand %>
<div class="fr ml5" style="width:25px; color: #3b94d6; white-space:nowrap; text-align:right; margin-right:5px;" onclick = "show_student_work(<%= student_work_path(st)%>)">评分</div>
<% end %>
</div>
<div class="hworkTip" style="display: none; left:710px; top:20px; white-space:nowrap; right:auto;" id="work_click_<%= st.id%>"><em></em><span></span><font class="fontGrey2"><%= !st.student_work_projects.empty? ? '大作品评分即组长的评分' : '点击进行评分' %></font></div>
<div class="fr ml5" style="width:25px; color: #3b94d6; white-space:nowrap; text-align:right; margin-right:5px; cursor: pointer;" onclick="show_student_work('<%= student_work_path(st)%>')">评分</div>
<div class="hworkTip" style="display: none; left:710px; top:20px; white-space:nowrap; right:auto;" id="work_click_<%= st.id%>"><em></em><span></span><font class="fontGrey2">点击进行评分</font></div>
</li>
</ul>

View File

@ -1,98 +1,65 @@
<div class="sy_courses_open f14 fontGrey3">
<span class="icons_sy_open fl mr5" title="点击展开/收起详情" style="cursor: pointer;"></span>
<span class="fl" style="width:280px;">
<span class="hidden fl" style="max-width:220px;"><%=student_work.name %></span>
<span class="fontGrey2 ml5 fl">
<% if student_work.work_status%>
<%=get_status student_work.work_status %>
<% end %>
</span>
</span>
<span class="fl" style="width:280px;">
<span class="hidden fl" style="max-width:220px;"><%= student_work.name %></span>
<span class="fontGrey2 ml5 fl">
<% if student_work.work_status %>
<%= get_status student_work.work_status %>
<% end %>
</span>
</span>
<div class="cl"></div>
<% if @homework.homework_detail_group.base_on_project == 1 %>
<div class="pr fr projectName">
<span class="fl ml25 fontGrey2">关联项目:</span>
<div class="pr fl projectName">
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
<%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fr hidden', :style => "max-width:200px;", :title => "项目名称", :target => "_blank"%>
<%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fl hidden', :style => "max-width:200px;", :title => "项目名称", :target => "_blank" %>
<% elsif User.current.allowed_to?(:as_teacher, @homework.course) %>
<%= link_to student_work.project.name, applied_join_project_path(:object_id => student_work.project.id, :is_teacher => 1), :remote => true, :method => "post", :class => 'link-blue fr hidden', :style => "max-width:200px;", :title => "项目名称" %>
<%= link_to student_work.project.name, applied_join_project_path(:object_id => student_work.project.id, :is_teacher => 1), :remote => true, :method => "post", :class => 'link-blue fl hidden', :style => "max-width:200px;", :title => "项目名称" %>
<% else %>
<span class="fontBlue fr hidden" style="max-width:200px;" title="该项目是私有的"><%= student_work.project.name %></span>
<% end %>
<% project = student_work.project %>
<div class="score-tip none tl f12" style="width:300px; top:-48px; right:-362px;">
<div class="score-tip none tl f12" style="width:300px; top:-48px; right:-930px;">
<em style="bottom:45px;"></em>
<font style="bottom:45px;"></font>
<p class="fb"><%= project.name %></p>
<p class="mb10"><span class="mr15">创建者:<%=project.creater %></span><span>成员数量:<%=project.members.count %></span></p>
<p class="mb10">
<span class="mr15">创建者:<%= project.creater %></span><span>成员数量:<%= project.members.count %></span></p>
<% project_score = project.project_score %>
<p>项目综合得分:<%=static_project_score(project_score).to_i %></p>
<p>项目综合得分:<%= static_project_score(project_score).to_i %></p>
<p>= 代码提交得分 + issue得分 + 资源得分 + 帖子得分</p>
<p>= <%=(project_score.changeset_num||0) * 4 %> + <%=project_score.issue_num * 4 + project_score.issue_journal_num %> + <%=project_score.attach_num * 5 %> + <%=project_score.board_num * 2 + project_score.board_message_num + project_score.news_num %></p>
<p>= <%= (project_score.changeset_num||0) * 4 %>
+ <%= project_score.issue_num * 4 + project_score.issue_journal_num %> + <%= project_score.attach_num * 5 %>
+ <%= project_score.board_num * 2 + project_score.board_message_num + project_score.news_num %></p>
</div>
</div>
<span class="fr">关联项目:</span>
<% end %>
<div class="cl"></div>
</div>
<div class="fl sy_p_grey">
<span class="fl" style="width:255px;">提交时间:<%=format_date(student_work.commit_time) %></span>
<div class="flex-container fl" style="width:376px;">
<div class="flex-cell">教师:<span class="<%= score_color student_work.teacher_score%>"><%= student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%></span></div>
<div class="flex-cell">助教:<span class="<%= score_color student_work.teaching_asistant_score%>"><%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%></span></div>
<span class="fl" style="width:180px;">提交时间:<%= format_date(student_work.commit_time) %></span>
<span class="fl" style="width:105px; text-align: center">学号</span>
<div class="flex-container fl" style="width:340px;">
<div class="flex-cell">教师</div>
<div class="flex-cell">助教</div>
<% if @homework.anonymous_comment == 0 %>
<div class="flex-cell">匿评:
<div class="<%= score_color student_work.student_score%> student_score_info pr" style="display: inline">
<% if student_work.student_score.nil? %>
<span title="该作品未被匿评">未参与</span>
<% else %>
<%= format("%.1f", student_work.student_score) %>
<% end %>
<% unless student_work.student_score.nil? %>
<span class="linkBlue">
(<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count %>)
</span>
<div class="g_infoNi none">
现共有
<span class="c_red">&nbsp;<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count %>&nbsp;</span>
名学生进行了匿评,平均分为
<span class="c_red">&nbsp;<%= format("%.1f", student_work.student_score) %>&nbsp;</span>分。
</div>
<% end %>
</div>
</div>
<div class="flex-cell">匿评</div>
<% end %>
<div class="flex-cell">成绩:
<% score = student_work.work_score %>
<div class="<%= score_color score%> student_final_scor_info pr" style="display: inline">
<%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
<% unless score.nil?%>
<div class="score-tip none tl" style="top:-48px; right:-229px;">
<em></em>
<font></font>
作品最终评分为
<span class="c_red">&nbsp;<%= student_work.final_score%>&nbsp;</span>分。<br/>
迟交扣分
<span class="c_red">&nbsp;
<%= student_work.late_penalty %>
&nbsp;</span>分,<br/>
缺评扣分
<span class="c_red">&nbsp;
<%= student_work.absence_penalty%>
&nbsp;</span>分,<br/>
最终成绩为
<span class="c_red">&nbsp;<%= format("%.1f",score<0 ? 0 : score)%>&nbsp;</span>分。
</div>
<% end%>
</div>
</div>
<div class="flex-cell">成绩</div>
</div>
<a href="javascript:void(0)" onclick="show_student_work('<%= student_work_path(student_work)%>');" class="link-blue fr ml5" style="width:28px; text-align:right;">评分</a>
</div>
<div class="cl"></div>
<script>
$(".projectName").mouseenter(function(){
$(this).children().next().show();
}).mouseleave(function(){
$(this).children().next().hide();
});
$(".projectName").mouseenter(function () {
$(this).children().next().show();
}).mouseleave(function () {
$(this).children().next().hide();
});
</script>

View File

@ -5,7 +5,5 @@
<div class="syllabus_class_box" id="student_work_<%= st.id%>" style="background-color:#fff;">
<%= render :partial => 'evaluation_un_group_member_work', :locals => {:st => st, :anon_count => anon_count} %>
</div>
<% if j != 0 %>
<div id="about_hwork_<%= st.id %>" class="about_hwork"></div>
<% end %>
<div id="about_hwork_<%= st.id %>" class="about_hwork"></div>
<% end %>

View File

@ -94,7 +94,7 @@
<% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%>
<!-- 老师 || 开启匿评状态 && 不是当前用户自己的作品 -->
<div id="add_student_score_<%= work.id%>" class="mt10 evaluation">
<%= render :partial => 'add_score',:locals => {:work => work,:score => score}%>
<%= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => false}%>
</div>
<% end%>
<div class="cl"></div>

View File

@ -84,7 +84,7 @@
<% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%>
<!-- 老师 || 开启匿评状态 && 不是当前用户自己的作品 -->
<div id="add_student_score_<%= work.id%>" class="mt10 evaluation">
<%= render :partial => 'add_score',:locals => {:work => work,:score => score}%>
<%= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => is_member_work}%>
</div>
<% end%>
<div class="cl"></div>
@ -101,7 +101,7 @@
<% if @is_teacher %>
<!-- 老师 -->
<div id="add_student_score_<%= work.id%>" class="mt10 evaluation">
<%= render :partial => 'add_score',:locals => {:work => work,:score => score}%>
<%= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => is_member_work}%>
</div>
<% end%>
<div class="cl"></div>

View File

@ -2,7 +2,12 @@
<span class="c_dark f14 fb fl mr15">
作品
<font class="f12 c_red">
(<span id="student_work_count"><%= @student_work_count%></span><%=@homework.homework_type == 3 ? '组' : '人' %>已交)
<% if @homework.homework_type == 3 %>
<% member_count = @homework.student_works.where("work_status != 0").count %>
(<%= @student_work_count%>组<%=member_count %>人已交)
<% else %>
(<%= @student_work_count%>人已交)
<% end %>
</font>
<%# my_work = @homework.student_works.where("user_id = #{User.current.id}").first %>
<% my_work = cur_user_works_for_homework @homework %>
@ -40,8 +45,8 @@
<div class="group_work_tip_box fontGrey2">
<em></em>
<span></span>
<p class="mt5 mb5 break_word">大作品评分即组长的评分<br/>
请先完成大作品评分,系统将把大作品<br/>评分做为每个组员的初始分值,您需<br/>要在此基础上对组员评分进行手动调整
<p class="mt5 mb5 break_word">组长评分即小组作品评分<br/>
组长评分时选择“组员同评”,本次评<br/>分结果将同时影响每个组员的评分。<br/>您可以继续对单个组员评分再调整或<br/>不调整
</p>
</div>
<% end %>

View File

@ -1,4 +1,5 @@
$("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'add_score',:locals => {:work => @work,:score => @new_score}) %>");
<% is_member_work = @homework.homework_type == 3 && @work.student_work_projects.empty? %>
$("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'add_score',:locals => {:work => @work,:score => @new_score,:is_member_work => is_member_work}) %>");
$('#score_<%= @work.id%>').peSlider({range: 'min'});
<%# if @is_new%>
@ -7,7 +8,6 @@ $('#score_<%= @work.id%>').peSlider({range: 'min'});
//$("#work_score_<%#= @score.id%>").html("<%#= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @new_score,:is_last => @is_last}) %>");
<%# 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();
$("#score_list_<%= @work.id%>").removeAttr("style");

View File

@ -1562,7 +1562,7 @@ function pop_box_new(value, Width, Height){
$(document.body).append(container);
$("#popupWrap").html(value);
$("#popupWrap").show();
$('#popupWrap').css({"top": h+"px","left": w+"px","padding":"0","border":"none","position":"fixed","z-index":"99999"});
$('#popupWrap').css({"top": h+"px","left": w+"px","padding":"0","border":"none","position":"fixed","z-index":"99999","background-color":"#fff","box-shadow": "0px 2px 8px rgba(146, 153, 169, 0.5)"});
$('#popupWrap').find("a[class*='close']").click(function(){
$("#popupWrap").hide();
});

View File

@ -1441,8 +1441,8 @@ a.syllabusbox_a_blue {
/*flex布局*/
.flex-container {display:flex;}
.flex-cell {flex:1;}
.flex-cell:last-child {text-align:right;}
.flex-cell {flex:1; text-align: center}
/*.flex-cell:last-child {text-align:right;}*/
/*新课程、项目公用样式提取*/
.sy_new_orange{font-size: 12px;padding: 0 5px;border-radius: 3px;line-height: 14px;color: #ff4a1b;border: 1px solid #ff4a1b;}