修改了以附件形式提交作业时,当作业为空时也能提交的BUG

修改了匿名用户提交作业的BUG
This commit is contained in:
fanqiang 2013-11-21 09:44:54 +08:00
parent 0381179536
commit 6a0d362241
2 changed files with 16 additions and 7 deletions

View File

@ -715,6 +715,7 @@ class BidsController < ApplicationController
end
def add_homework
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)
# homework = HomeworkAttach.create(:bid_id => @bid.id, :user_id => User.current.id)
# homework.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads]))
@homework = HomeworkAttach.new
@ -722,6 +723,12 @@ class BidsController < ApplicationController
@homework.user_id = User.current.id
@homework.save_attachments(params[:attachments])
@homework.save
if @homework.attachments.empty?
@homework.delete
flash[:error] = l(:no_attachmens_allowed)
# else
end
end
@homework_list = @bid.homeworks
end

View File

@ -1311,6 +1311,8 @@ zh:
button_bidding: 我要参加
field_enterprise: '企业:'
no_attachmens_allowed: 提交作业不能为空
button_bidding_homework: 参加竞标 #huang
field_homework_type: 提交形式 #bai
label_homework_respond: 作业情况