<!-- 匿评作品列表，显示某一个作品的信息 -->
<tr class="hworkListRow" id="student_work_<%= student_work.id%>">
  <td class="none"><a name="<%= student_work.id%>"></a></td>
  <td class="hworkList30 pl5 pr5" id="work_num_<%=student_work.id %>"><%=index + 1 %></td>
  <td class="hworkPortrait pr10 float-none">
    <%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40",:style => "display:block;"),user_activities_path(student_work.user)) %>
  </td>
  <% if @homework.homework_type != 3 %>
      <td class="hworkName float-none pr10 student_work_<%= student_work.id%> <%= @homework.homework_type == 2 ? '' : 'width130'%>" style="cursor: pointer;" onclick="show_student_work('<%= student_work_path(student_work)%>');">
        <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
        <div>
          <%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
        </div>
      </td>
        <td class="<%=@homework.anonymous_comment == 1 ? 'hworkStName100' : 'hworkStName'%> pr10 student_work_<%= student_work.id%>" title="<%= student_work.user.show_name%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor:pointer;">
          <%= student_work.user.show_name%>
        </td>
        <td class="<%=@homework.anonymous_comment == 1 ? 'hworkStID90' : 'hworkStID'%> pr10 float-none student_work_<%= student_work.id%>" title="<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor:pointer;">
          <span style="width:80px;" class="hidden fl"><%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%></span>
        </td>
  <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
      <td class="hworkName float-none pr10 student_work_<%= student_work.id%> width130" style="cursor: pointer;" onclick="show_student_work('<%= student_work_path(student_work)%>');">
        <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
        <div>
          <%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
        </div>
      </td>
        <% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
            <td  class="<%=@homework.anonymous_comment == 1 ? 'hworkPrName2' : 'hworkPrName'%> student_work_<%= student_work.id%>" title="项目名称">
              <%= link_to( student_work.project.name, project_path(student_work.project.id))%>
            </td>
        <% else %>
            <td class="hworkPrName student_work_<%= student_work.id%>" title="该项目是私有的">
              <%= student_work.project.name %>
            </td>
        <% end %>
  <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 %>
      <td class="hworkName float-none pr10 student_work_<%= student_work.id%> <%=@homework.anonymous_comment == 1 ? 'width340' : 'width290' %>" style="cursor: pointer;" onclick="show_student_work('<%= student_work_path(student_work)%>');">
        <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
        <div>
          <%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
        </div>
      </td>
  <% end %>
  <td class="hworkList130 c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
    <% if student_work.created_at && @homework.end_time%>
        <%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>&nbsp;
        <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %>
            <span class="c_red">[迟交]</span>
        <% end %>
    <% end %>
  </td>
  <td class="hworkList50 <%= score_color student_work.teacher_score%>">
    <%= student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%>
  </td>
  <td class="hworkList50 <%= score_color student_work.teaching_asistant_score%>">
    <%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%>
  </td>

  <% if @homework.homework_type == 2%>
      <!-- 系统评分 -->
      <td class="hworkList50 <%= score_color student_work.system_score%>">
        <%= student_work.system_score.nil? ? "--" : format("%.1f",student_work.system_score)%>
      </td>
  <% end%>

  <% if @homework.anonymous_comment == 0%>
    <td class="hworkList50 <%= score_color student_work.student_score%> student_score_info">
      <% 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="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%>
  </td>
  <% end %>
  <!-- 成绩 -->
  <% if student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score %>
    <% score = student_work.respond_to?("score") ? student_work.score : student_work.teacher_score %>
  <% else %>
    <% score = student_work.respond_to?("score") ? student_work.score : (student_work.final_score || 0) - student_work.absence_penalty - student_work.late_penalty%>
  <% end %>
  <td class="hworkList50 <%= score_color score%> student_final_scor_info">
    <%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
    <% unless score.nil?%>
        <div class="infoNi none width180">
          作品最终评分为
          <span class="c_red">&nbsp;<%= student_work.final_score%>&nbsp;</span>分。
          迟交扣分
          <span class="c_red">&nbsp;
            <%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.late_penalty %>
            &nbsp;</span>分，
          缺评扣分
          <span class="c_red">&nbsp;
            <%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.absence_penalty%>
            &nbsp;</span>分，
          最终成绩为
          <span class="c_red">&nbsp;<%= format("%.1f",score<0 ? 0 : score)%>&nbsp;</span>分。
        </div>
    <% end%>
  </td>
  <td><div style="position:relative;"><div class="hworkTip" style="display: none" id="work_click_<%= student_work.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></div></div></td>
</tr>
<script type="text/javascript">
    $(".student_work_<%= student_work.id%>").mouseenter(function(){
        if($("#about_hwork_<%= student_work.id%>").html().trim() == "") {
            $("#work_click_<%= student_work.id%>").show();
        }
    }).mouseleave(function(){
        $("#work_click_<%= student_work.id%>").hide();
    }).mouse;
</script>

