add project package task

dev_forum
p31729568 5 years ago
parent 2d80cfe6e2
commit 24b14b9944

@ -64,7 +64,7 @@ class ProjectPackage < ApplicationRecord
def bidding_end?
flag = deadline?
end_bidding! if flag && may_end_bidding?
ProjectPackages::EndBiddingService.call(self) if flag && may_end_bidding?
flag
end

@ -0,0 +1,12 @@
class CheckProjectPackageDeadlineTask
def call
ProjectPackage.where(status: :published).where('deadline_at < ?', Time.now).find_each do |package|
begin
ProjectPackages::EndBiddingService.new(package).call
rescue => ex
Rails.logger.error ex.message
Rails.logger.error ex.backtrace.join('\n')
end
end
end
end
Loading…
Cancel
Save