From cfb7d211691d4c2355b3dadd656d92131327dde8 Mon Sep 17 00:00:00 2001 From: jmaeng72 <44305062+jmaeng72@users.noreply.github.com> Date: Fri, 1 Nov 2024 09:37:05 -0400 Subject: [PATCH] update collection progress superseded to become complete during migrate down --- .../cmr/umm_spec/migration/version/collection.clj | 15 ++++++--------- .../test/migration/version/collection.clj | 8 ++++---- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/umm-spec-lib/src/cmr/umm_spec/migration/version/collection.clj b/umm-spec-lib/src/cmr/umm_spec/migration/version/collection.clj index 9ae26c4bac..9258428ef8 100644 --- a/umm-spec-lib/src/cmr/umm_spec/migration/version/collection.clj +++ b/umm-spec-lib/src/cmr/umm_spec/migration/version/collection.clj @@ -768,13 +768,11 @@ (defn- migrate-collection-progress-down [collectionProgress] - (if (nil? collectionProgress) - "NOT PROVIDED" - (if (or (= "PREPRINT" collectionProgress) - (= "INREVIEW" collectionProgress) - (= "SUPERSEDED" collectionProgress)) - "PLANNED" - collectionProgress))) + (case collectionProgress + "PREPRINT" "PLANNED" + "INREVIEW" "PLANNED" + "SUPERSEDED" "COMPLETE" + collectionProgress)) (defmethod interface/migrate-umm-version [:collection "1.18.2" "1.18.1"] [_context collection & _] @@ -782,7 +780,6 @@ ;; Remove AssociatedDOIs/Type enums: IsPreviousVersionOf and IsNewVersionOf ;; Remove PREPRINT, INREVIEW, and SUPERSEDED enums to CollectionProgress ;; Add back in NOT APPLICABLE enum in CollectionProgress - ;(m-spec/update-version collection :collection "1.18.1") (-> collection (m-spec/update-version :collection "1.18.1") @@ -791,7 +788,7 @@ (-> coll (util/update-in-each [:AssociatedDOIs] migrate-associated-doi-type-down)) coll)) - ;; Change CollectionProgress enum to PLANNED if its enum value is PREPRINT, INREVIEW, or SUPERSEDED + ;; Change CollectionProgress enum to PLANNED if its enum value is PREPRINT, INREVIEW. And COMPLETE if enum value is SUPERSEDED (as-> coll (if (contains? coll :CollectionProgress) (-> coll (update :CollectionProgress migrate-collection-progress-down)) diff --git a/umm-spec-lib/test/cmr/umm_spec/test/migration/version/collection.clj b/umm-spec-lib/test/cmr/umm_spec/test/migration/version/collection.clj index 0fdd4c5a49..6045636361 100644 --- a/umm-spec-lib/test/cmr/umm_spec/test/migration/version/collection.clj +++ b/umm-spec-lib/test/cmr/umm_spec/test/migration/version/collection.clj @@ -3885,7 +3885,7 @@ :Version "1.18.2"}} ) - "Migrating CollectionProgress enum PREPRINT back to COMPLETED" + "Migrating CollectionProgress enum PREPRINT back to PLANNED" ;; expected {:CollectionProgress "PLANNED" :MetadataSpecification {:URL "https://cdn.earthdata.nasa.gov/umm/collection/v1.18.1", @@ -3897,7 +3897,7 @@ :Name "UMM-C", :Version "1.18.2"}} - "Migrating CollectionProgress enum PREPRINT back to COMPLETED" + "Migrating CollectionProgress enum PREPRINT back to PLANNED" ;; expected {:CollectionProgress "PLANNED" :MetadataSpecification {:URL "https://cdn.earthdata.nasa.gov/umm/collection/v1.18.1", @@ -3909,9 +3909,9 @@ :Name "UMM-C", :Version "1.18.2"}} - "Migrating CollectionProgress enum SUPERSEDED back to COMPLETED" + "Migrating CollectionProgress enum SUPERSEDED back to COMPLETE" ;; expected - {:CollectionProgress "PLANNED" + {:CollectionProgress "COMPLETE" :MetadataSpecification {:URL "https://cdn.earthdata.nasa.gov/umm/collection/v1.18.1", :Name "UMM-C", :Version "1.18.1"}}