mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-04 20:25:22 +08:00
Fix migration of protocol template assignments [SCI-12283]
This commit is contained in:
parent
d30e1a0a7b
commit
ee32a73694
2 changed files with 7 additions and 3 deletions
|
@ -720,19 +720,19 @@ class Protocol < ApplicationRecord
|
|||
private
|
||||
|
||||
def after_user_assignment_changed(user_assignment)
|
||||
return unless in_repository_published_original?
|
||||
return if skip_user_assignments || !in_repository_published_original?
|
||||
|
||||
sync_child_protocol_assignment(user_assignment)
|
||||
end
|
||||
|
||||
def after_user_group_assignment_changed(user_group_assignment)
|
||||
return unless in_repository_published_original?
|
||||
return if skip_user_assignments || !in_repository_published_original?
|
||||
|
||||
sync_child_protocol_assignment(user_group_assignment)
|
||||
end
|
||||
|
||||
def after_team_assignment_changed(user_group_assignment)
|
||||
return unless in_repository_published_original?
|
||||
return if skip_user_assignments || !in_repository_published_original?
|
||||
|
||||
sync_child_protocol_assignment(user_group_assignment)
|
||||
end
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'activerecord-import/base'
|
||||
require 'activerecord-import/active_record/adapters/postgresql_adapter'
|
||||
|
||||
class MoveEveryOneElseAssignmentToTeamAssignments < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
# rubocop:disable Metrics/BlockLength
|
||||
|
@ -141,6 +144,7 @@ class MoveEveryOneElseAssignmentToTeamAssignments < ActiveRecord::Migration[7.2]
|
|||
|
||||
return if scope.blank?
|
||||
|
||||
record.skip_user_assignments = true
|
||||
record.team_assignments.create!(team_id: team_id, user_role: scope.first.user_role)
|
||||
scope.delete_all
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue