@ -715,13 +715,20 @@ class BidsController < ApplicationController
end
def add_homework
# 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
@homework . bid_id = @bid . id
@homework . user_id = User . current . id
@homework . save_attachments ( params [ :attachments ] )
@homework . save
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
@homework . bid_id = @bid . id
@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