Statuses in task - db field and forms

This commit is contained in:
2025-10-25 17:41:06 +03:00
parent b08468568b
commit ba2aad93af
12 changed files with 86 additions and 13 deletions
+15
View File
@@ -0,0 +1,15 @@
# frozen_string_literal: true
namespace :data_migrations do
desc 'Set initial status for tasks'
task set_initial_status_for_tasks: :environment do
Task.includes(project: :task_statuses).in_batches do |tasks|
projects = Project.where(id: tasks.pluck(:project_id))
statuses = TaskStatus.backlog.where(project: projects).group_by(&:project)
tasks.each do |task|
task.update!(status: statuses[task.project].first)
end
end
end
end