匿评开启前学生能看到提交的作品数

This commit is contained in:
cxt 2015-10-28 14:22:17 +08:00
parent bd350536eb
commit d851364e70
3 changed files with 9 additions and 4 deletions

View File

@ -108,6 +108,7 @@ class StudentWorkController < ApplicationController
else else
@stundet_works = [] @stundet_works = []
end end
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name).count
else else
if @is_teacher || @homework.homework_detail_manual.nil? #老师 || 超级管理员 显示所有列表 if @is_teacher || @homework.homework_detail_manual.nil? #老师 || 超级管理员 显示所有列表
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
@ -128,6 +129,7 @@ class StudentWorkController < ApplicationController
else else
@stundet_works = [] @stundet_works = []
end end
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name).count
end end
@score = @b_sort == "desc" ? "asc" : "desc" @score = @b_sort == "desc" ? "asc" : "desc"

View File

@ -2355,16 +2355,16 @@ module ApplicationHelper
else #学生显示提交作品、修改作品等按钮 else #学生显示提交作品、修改作品等按钮
work = cur_user_works_for_homework homework work = cur_user_works_for_homework homework
if work.nil? if work.nil?
link_to "提交作品", new_student_work_path(:homework => homework.id),:class => 'c_blue' link_to "提交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
else else
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前 if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前
link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品" link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
link_to "匿评结束", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "匿评已结束" link_to "匿评结束", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "匿评已结束"
elsif homework.homework_type == 2 #编程作业不能修改作品 elsif homework.homework_type == 2 #编程作业不能修改作品
link_to "修改作品", new_student_work_path(:homework => homework.id),:class => 'c_blue' link_to "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
else else
link_to "修改作品", edit_student_work_path(work.id),:class => 'c_blue' link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue'
end end
end end
end end

View File

@ -2,8 +2,11 @@
<span class="c_dark f14 fb fl mr30"> <span class="c_dark f14 fb fl mr30">
作品 作品
<font class="f12 c_red"> <font class="f12 c_red">
<%= @stundet_works.count%> <%= @student_work_count%>
</font> </font>
<% if !@is_teacher && @stundet_works.empty?%>
<span class="f12 c_red">未提交</span>
<% end %>
</span> </span>
<%if @is_teacher || @homework.homework_detail_manual.comment_status == 3%> <%if @is_teacher || @homework.homework_detail_manual.comment_status == 3%>
<div class="hworkSearchBox"> <div class="hworkSearchBox">