Skip to content

Instantly share code, notes, and snippets.

@mabsboza
Last active March 7, 2023 20:22
Show Gist options
  • Save mabsboza/8b68e0141c7d275c0a3186151080160a to your computer and use it in GitHub Desktop.
Save mabsboza/8b68e0141c7d275c0a3186151080160a to your computer and use it in GitHub Desktop.
ContractorWorker.all.each do |worker|
worker_status = if worker.banished_at?
ContractorWorker::Status::DISABLED
elsif !worker.approved?
ContractorWorker::Status::REJECTED
elsif worker.approved? && worker.without_access
ContractorWorker::Status::INCOMPLETE
elsif worker.approved? && !worker.without_access
ContractorWorker::Status::APPROVED
else
ContractorWorker::Status::PENDING
end
worker.update(status: worker_status)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment