学生看到的作业个数不包含未发布的作业

This commit is contained in:
cxt 2016-02-24 16:20:59 +08:00
parent 2aa0fefa1c
commit 5e330de31a
1 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,11 @@
<%# course_model %>
<% course_file_num = visable_attachemnts_incourse(@course).count%>
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,@course) %>
<% homework_num = @course.homework_commons.count %>
<% else %>
<% homework_num = @course.homework_commons.where("publish_time <= '#{Date.today}'").count %>
<% end %>
<!DOCTYPE html>
<html lang="en">
<head>
@ -74,7 +79,7 @@
<% unless show_nav?(@course.homework_commons.count) %>
<div class="subNav">
<%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02"%>
<%= link_to "(#{@course.homework_commons.count})", homework_common_index_path(:course => @course.id), :class => "subnav_num c_orange"%>
<%= link_to "(#{homework_num})", homework_common_index_path(:course => @course.id), :class => "subnav_num c_orange"%>
<%= link_to( "", homework_common_index_path(:course => @course.id,:is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_course_homework_new)}") if is_teacher %>
</div>
<% end %>