Skip to content

Commit

Permalink
update collection progress superseded to become complete during migra…
Browse files Browse the repository at this point in the history
…te down
  • Loading branch information
jmaeng72 committed Nov 1, 2024
1 parent 78800dd commit cfb7d21
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
15 changes: 6 additions & 9 deletions umm-spec-lib/src/cmr/umm_spec/migration/version/collection.clj
Original file line number Diff line number Diff line change
Expand Up @@ -768,21 +768,18 @@
(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 & _]
;; Migrating down version 1.18.2 to 1.18.1
;; 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")
Expand All @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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"}}
Expand Down

0 comments on commit cfb7d21

Please sign in to comment.