Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
daiao 2018-03-22 16:54:58 +08:00
commit ba73d7a30c
10 changed files with 126 additions and 28 deletions

View File

@ -755,7 +755,7 @@ class StudentWorkController < ApplicationController
@score = student_work_score @work,User.current
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
if @homework.homework_detail_manual.comment_status == 2 && !@is_teacher && @work.user != User.current
@student_work_scores = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").order("updated_at desc")
@student_work_scores = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").order("updated_at desc").limit(1)
else
@student_work_scores = student_work_score_record(@work)
end

View File

@ -75,11 +75,11 @@ module StudentWorkHelper
#获取学生作品的评分记录:同一个教师或教辅只显示未隐藏的评分
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 is_hidden = 0 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")
scores = work.student_works_scores.where(:is_hidden => false).order("created_at desc")
sql = "SELECT MAX(id) id FROM student_works_scores WHERE reviewer_role = 3 AND student_work_id = #{work.id} GROUP BY user_id"
st_ids = StudentWorksScore.find_by_sql sql
st_ids = st_ids.empty? ? "(-1)" : "(" + st_ids.map{|tea| tea.id}.join(",") + ")"
scores = work.student_works_scores.where("is_hidden = 0 and (reviewer_role = 2 or reviewer_role = 1) or (reviewer_role = 3 and id in #{st_ids})").order("updated_at desc")
# scores = work.student_works_scores.where(:is_hidden => false).order("created_at desc")
return scores
end

View File

@ -112,7 +112,7 @@
<% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%>
<!-- 老师 || 开启匿评状态 && 不是当前用户自己的作品 -->
<ul id="add_student_score_<%= work.id%>" class="mt10 evaluation">
<%= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => false}%>
<%= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => false, :show_or_hide => !student_work_scores.empty?}%>
</ul>
<% end%>
<div class="cl"></div>
@ -124,12 +124,19 @@
</div>
<div class="cl"></div>
<div class="ping_box fl" id="score_list_<%= work.id%>" style="<%= student_work_scores.empty? ? 'padding:0px;' : ''%>">
<div class="ping_box fl" id="score_list_<%= work.id%>" style="display: none; <%= student_work_scores.empty? ? 'padding:0px;' : ''%>">
<%= render :partial => 'student_work_score_records', :locals => {:student_work_scores => student_work_scores, :is_member_work => false} %>
</div>
<div class="cl"></div>
<!---ping_box end--->
<a href="javascript:void(0);" class="linkBlue mt5 mb5" style="margin-left:auto; margin-right: auto; display:block; width: 24px;" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>
<div class="clearfix">
<% if !student_work_scores.empty? %>
<a href="javascript:void(0);" class="linkBlue mt5 fl mb5" style="margin-left:5px; margin-right: auto; display:block; width: 24px;" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>
<a href="javascript:void(0);" class="linkBlue mt5 fr mb5" style="margin-left:auto; margin-right: auto; display:block;" id="toggle_score_<%= work.id %>" onclick="toggle_student_score(<%= work.id%>);">展开评阅详情</a>
<% else %>
<a href="javascript:void(0);" class="linkBlue mt5 mb5" style="margin-left:auto; margin-right: auto; display:block; width: 24px;" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>
<% end %>
</div>
<div class="cl"></div>
</div>
<script type="text/javascript">

View File

@ -39,9 +39,10 @@
<span class="tit_fb"> 参与人员:</span>
<%= link_to(work.user.show_name+"(组长)", user_path(work.user.id), :class => "linkBlue" )%>
<% members = work.student_work_projects.where("is_leader = 0") %>
<% members.each do |member| if !members.empty? %>
<% if !members.empty? %>
<% members.each do |member| %>
、<%=link_to((User.find member.user_id).show_name, user_path(member.user.id), :class => "linkBlue" ) %>
<% end %>
<% end %>
<% end %>
</li>
<% if @homework.homework_detail_group.base_on_project == 1 %>
@ -84,7 +85,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,:is_member_work => is_member_work}%>
<%= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => is_member_work, :show_or_hide => !student_work_scores.empty?}%>
</div>
<% end%>
<div class="cl"></div>
@ -109,12 +110,19 @@
</ul>
<% end %>
<div class="ping_box fl" id="score_list_<%= work.id%>" style="<%= student_work_scores.empty? ? 'padding:0px;' : ''%>">
<div class="ping_box fl" id="score_list_<%= work.id%>" style="display: none; <%= student_work_scores.empty? ? 'padding:0px;' : ''%>">
<%= render :partial => 'student_work_score_records', :locals => {:student_work_scores => student_work_scores, :is_member_work => is_member_work} %>
</div>
<div class="cl"></div>
<!---ping_box end--->
<a href="javascript:void(0);" class="linkBlue mt5 mb5" style="margin-left:auto; margin-right: auto; display:block; width: 24px;" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>
<div class="clearfix">
<% if !student_work_scores.empty? %>
<a href="javascript:void(0);" class="linkBlue mt5 fl mb5" style="margin-left:5px; margin-right: auto; display:block; width: 24px;" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>
<a href="javascript:void(0);" class="linkBlue mt5 fr mb5" style="margin-left:auto; margin-right: auto; display:block;" id="toggle_score_<%= work.id %>" onclick="toggle_student_score(<%= work.id%>);">展开评阅详情</a>
<% else %>
<a href="javascript:void(0);" class="linkBlue mt5 mb5" style="margin-left:auto; margin-right: auto; display:block; width: 24px;" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>
<% end %>
</div>
<div class="cl"></div>
</div>
<script type="text/javascript">

View File

@ -72,11 +72,83 @@
<div id="replay_histroy_<%= score.id%>">
<% score.journals_for_messages.order("created_on desc").each do |jour|%>
<% show_real_name = @is_teacher || score.reviewer_role != 3 || @homework.homework_detail_manual.comment_status != 2 %>
<%= render :partial => 'jour_replay',:locals => {:jour => jour, :show_real_name => show_real_name || jour.user == User.current}%>
<% r_show_real_name = @is_teacher || score.reviewer_role != 3 || @homework.homework_detail_manual.comment_status != 2 %>
<%= render :partial => 'jour_replay',:locals => {:jour => jour, :show_real_name => r_show_real_name || jour.user == User.current}%>
<% end%>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
<% if score.reviewer_role == 3 && score.student_work.student_works_scores.where("reviewer_role = 3 and user_id = #{score.user_id} and id != #{score.id}").count > 0 %>
<% score.student_work.student_works_scores.where("reviewer_role = 3 and user_id = #{score.user_id} and id != #{score.id}").each do |s_score| %>
<div class="pingBoxTit ping_line_top" style="margin-left: 50px;">
<%= link_to show_real_name ? s_score.user.show_name : "匿名", show_real_name ? user_path(s_score.user) : "javascript:void(0)", :title => show_real_name ? s_score.user.show_name : "匿评用户", :class => "linkBlue fl" %>
<span class="ml5 fl">(学生)</span>
<span class="ml20 fl">评分:</span>
<a href="javascript:void(0);" class="c_orange fl" >
<%= show_real_score ? s_score.score : "**" %>分
</a>
<a href="javascript:void(0);" class="fr linkBlue mr5" onclick="$('#add_score_reply_<%= s_score.id%>').slideToggle();">回复</a>
<% if @homework.anonymous_appeal == 1 %>
<% if s_score.student_work.user == User.current && s_score.reviewer_role == 3 && s_score.appeal_status == 0 %>
<!--<a href="<%#=alert_appeal_box_student_work_index_path(:score_id => score.id,:is_last => is_last) %>" data-remote="true" class="fr linkBlue mr10">申诉</a>-->
<% elsif s_score.reviewer_role == 3 && s_score.appeal_status == 1 %>
<span class="c_red fr mr10">申诉中</span>
<% elsif s_score.reviewer_role == 3 && s_score.appeal_status == 2 %>
<span class="c_red fr mr10">申诉已撤销</span>
<% elsif s_score.reviewer_role == 3 && s_score.appeal_status == 3 %>
<span class="c_red fr mr10">申诉成功</span>
<% elsif s_score.reviewer_role == 3 && s_score.appeal_status == 4 %>
<span class="c_red fr mr10">申诉失败</span>
<% end %>
<% end %>
<span class="fr c_grey mr20">
<%=format_time s_score.updated_at %>
</span>
<div class="cl mb5"></div>
<p class="break_word">
<%= s_score.comment%>
</p>
<div class="cl"></div>
<%= render :partial => 'work_attachments', :locals => {:attachments => s_score.attachments} %>
<div class="cl"></div>
<div id="add_score_reply_<%= s_score.id%>" class="undis">
<%= render :partial => 'add_score_reply',:locals => {:score => s_score,:is_last => is_last}%>
</div>
<div class="cl"></div>
<% unless s_score.student_works_scores_appeal.nil? %>
<div class="ping_back mt10" style="border-top: 1px dashed #CCCCCC; padding-top: 10px;">
<span class="fl">申诉</span>
<% if s_score.appeal_status == 1 && s_score.student_work.user == User.current %>
<a href="javascript:void(0)" onclick="delete_confirm_box('<%=deal_appeal_score_student_work_index_path(:is_last=>is_last,:score_id=>s_score.id,:status=>2) %>', '撤销后将不能再对该成绩发起申诉<br/>您是否确认撤销申诉');" class="fr linkBlue mr5 ml20">撤销申诉</a>
<% elsif @is_teacher && score.appeal_status == 1 %>
<a href="javascript:void(0)" onclick="delete_confirm_box('<%=deal_appeal_score_student_work_index_path(:is_last=>is_last,:score_id=>s_score.id,:status=>3) %>', '此匿评成绩将被废弃,且评阅人的作品<br/>将被违规扣分,您是否确定接受');" class="fr linkBlue mr5">接受</a>
<a href="javascript:void(0)" onclick="delete_confirm_box('<%=deal_appeal_score_student_work_index_path(:is_last=>is_last,:score_id=>s_score.id,:status=>4) %>', '此匿评成绩将被认为合理<br/>您是否确定拒绝');" class="fr linkBlue mr10 ml20">拒绝</a>
<% end %>
<span class="fr c_grey">
<%=format_time s_score.student_works_scores_appeal.updated_at %>
</span>
<div class="cl mb5"></div>
<p class="break_word">
申诉理由:<%= s_score.student_works_scores_appeal.comment%>
</p>
</div>
<% end %>
<div id="replay_histroy_<%= s_score.id%>">
<% s_score.journals_for_messages.order("created_on desc").each do |jour|%>
<% r_show_real_name = @is_teacher || s_score.reviewer_role != 3 || @homework.homework_detail_manual.comment_status != 2 %>
<%= render :partial => 'jour_replay',:locals => {:jour => jour, :show_real_name => r_show_real_name || jour.user == User.current}%>
<% end%>
</div>
<div class="cl"></div>
</div>
<% end %>
<% end %>
</ul>

View File

@ -69,16 +69,18 @@
<% projects = activity.student_work_projects.where("is_leader = 1") %>
<% unless projects.empty? %>
<% sort_projects = project_sort_update projects %>
<div class="mt10 relatePWrap" id="relatePWrap_<%=user_activity_id %>">
<div class="mr5 fontGrey2">
<% first_pro_act = sort_projects.first %>
<% first_pro = Project.find first_pro_act.project_id %>
<% commit_time = first_pro.project_score.commit_time %>
<%# one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %>
#&nbsp;<%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(first_pro_act.updated_at) ? commit_time : first_pro_act.updated_at %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目
<% unless sort_projects.empty? %>
<div class="mt10 relatePWrap" id="relatePWrap_<%=user_activity_id %>">
<div class="mr5 fontGrey2">
<% first_pro_act = sort_projects.first %>
<% first_pro = Project.find first_pro_act.project_id %>
<% commit_time = first_pro.project_score.commit_time %>
<%# one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %>
#&nbsp;<%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(first_pro_act.updated_at) ? commit_time : first_pro_act.updated_at %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
<% end %>
<% end %>
<% end %>
<div class="cl"></div>

View File

@ -627,9 +627,9 @@
</li>
</div>
<!--<div style="display: none" class="message_title_red system_message_style">-->
<!--<p>-->
<!--<p>
<%#= User.current.lastname + User.current.firstname %>老师您好!您成功创建了一个班级,详情如下:
<!--</p>-->
</p>-->
<!--<p>班级名称:<%#= ma.course_message.name %></p>-->
<!--<p>开课学期:<%#= ma.course_message.time.to_s + '年' + ma.course_message.term %></p>-->
<!--<p>班级ID<span style="color:red;"><%#= ma.course_message.id %></span></p>-->

View File

@ -4,7 +4,7 @@
<span class="f12 c_red mt5 fr">温馨提示:请至少输入一组样例供学生参考。</span>
<div class="cl"></div>
<% if edit_mode && homework.is_program_homework? && homework.homework_samples.count > 0 %>
<% if edit_mode && homework.is_program_homework? && homework.homework_samples.length > 0 %>
<% homework.homework_samples.each_with_index do |sample, index| %>
<div class="mt10" style="margin-left:57px;">
<label class="fl fontGrey2 mr10 mt5 w20" name="sample_inputs_label"><%= index+1 %>&nbsp;&nbsp;</label>

View File

@ -2340,3 +2340,11 @@ function init_exercise_quetison_editor(params){
return editor;
}
function toggle_student_score(id){
$('#score_list_' + id).toggle();
if($('#score_list_' + id).is(':visible')){
$("#toggle_score_" + id).html("收起评阅详情");
} else{
$("#toggle_score_" + id).html("展开评阅详情");
}
}

View File

@ -285,6 +285,7 @@ a:hover.ping_pic{border:1px solid #3b94d6;}
.ping_box_tit{ float:left; width:575px; margin-left:10px;}
.ping_box_ul{}
.ping_line{ border-bottom:1px dashed #CCCCCC; padding-bottom:8px; margin-bottom:8px;}
.ping_line_top{ border-top:1px dashed #CCCCCC; padding-top:8px; margin-top:8px;}
.ping_text{border:1px solid #CCCCCC; margin:5px; padding:5px; width:610px; height:20px; }
.ping_back_tit{ float:left; width:578px; margin-left:10px; }
a.down_btn{ border:1px solid #CCC; color:#999; padding:0px 5px; font-size:12px; text-align:center; display:block;}