From 29ac5ff12a70e00fb46189c598e5dc7d91800aa9 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 4 Jun 2014 09:55:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E5=BD=93=E5=89=8D=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=B7=B2=E7=BB=8F=E6=8F=90=E4=BA=A4=E8=BF=87=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E5=B0=B1=E4=B8=8D=E6=98=BE=E7=A4=BA=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 5 +++++ app/views/bids/_homework.html.erb | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 959d36cb0..b0c7e1861 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -157,4 +157,9 @@ module CoursesHelper end people.include?(User.current) end + #获取当前用户在指定作业下提交的作业的集合 + def cur_user_homework_for_bid bid + cur_user_homework = HomeworkAttach.where("user_id = ? and bid_id = ?",User.current,params[:id]) + cur_user_homework + end end diff --git a/app/views/bids/_homework.html.erb b/app/views/bids/_homework.html.erb index d9ce738d8..4e2681ba6 100644 --- a/app/views/bids/_homework.html.erb +++ b/app/views/bids/_homework.html.erb @@ -13,17 +13,19 @@ <% end %> -<% if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) %> +<% if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && + (Member.where('user_id = ? and project_id = ?', User.current.id, + @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) && cur_user_homework_for_bid(@bid).count == 0 %>