mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-01 12:38:30 +08:00
Update protocols migration for linked protocols [SCI-6931]
This commit is contained in:
parent
09a217baca
commit
9885dc0f29
2 changed files with 7 additions and 4 deletions
|
@ -351,7 +351,11 @@ class Protocol < ApplicationRecord
|
|||
end
|
||||
|
||||
def parent_newer?
|
||||
linked? && parent.newer_published_version_present?
|
||||
linked? && (
|
||||
parent.newer_published_version_present? ||
|
||||
# backward compatibility with original implementation
|
||||
parent.published_on > updated_at
|
||||
)
|
||||
end
|
||||
|
||||
def number_of_steps
|
||||
|
|
|
@ -36,9 +36,8 @@ class AddProtocolVersioning < ActiveRecord::Migration[6.1]
|
|||
');'
|
||||
)
|
||||
execute(
|
||||
'UPDATE "protocols" SET "published_on" = "created_at", "published_by_id" = "added_by_id" ' \
|
||||
'WHERE "protocols"."protocol_type" = 5 ' \
|
||||
'AND "protocols"."published_on" IS NULL;'
|
||||
'UPDATE "protocols" SET "published_on" = "updated_at", "published_by_id" = "added_by_id" ' \
|
||||
'WHERE "protocols"."protocol_type" = 5;'
|
||||
)
|
||||
|
||||
execute(
|
||||
|
|
Loading…
Reference in a new issue