Project.joins_import_state.where("(import_state.status = 'scheduled' OR import_state.status = 'started') OR (projects.import_status = 'scheduled' OR projects.import_status = 'started')")
end
defenqueued_projects_with_jid
enqueued_projects.where.not(import_jid: nil)
enqueued_projects.where.not("import_state.jid IS NULL AND projects.import_jid IS NULL")
end
defenqueued_projects_without_jid
enqueued_projects.where(import_jid: nil)
enqueued_projects.where("import_state.jid IS NULL AND projects.import_jid IS NULL")