Skip to content

Commit be169a6

Browse files
committed
update migration func to substitute correct enums
1 parent 1845d8d commit be169a6

File tree

1 file changed

+29
-24
lines changed

1 file changed

+29
-24
lines changed

umm-spec-lib/src/cmr/umm_spec/migration/version/collection.clj

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -748,27 +748,32 @@
748748
;; Add AssociatedDOIs/Type enums: IsPreviousVersionOf and IsNewVersionOf
749749
;; Add PREPRINT, INREVIEW, and SUPERSEDED enums to CollectionProgress
750750
;; Remove NOT APPLICABLE enum from CollectionProgress
751-
(-> collection
752-
(m-spec/update-version :collection "1.18.2")))
753-
754-
;; TODO what does this method actually do? Is it to update the actual data?
755-
;(defmethod interface/migrate-umm-version [:collection "1.18.2" "1.18.1"]
756-
; [_context collection & _]
757-
; ;; Migrating down version 1.18.2 to 1.18.1
758-
; ;; Remove AssociatedDOIs/Type enums: IsPreviousVersionOf and IsNewVersionOf
759-
; ;; Remove PREPRINT, INREVIEW, and SUPERSEDED enums to CollectionProgress
760-
; ;; Add back in NOT APPLICABLE enum in CollectionProgress
761-
; (util/remove-nils-empty-maps-seqs
762-
; (-> collection
763-
; (m-spec/update-version :collection "1.18.1")
764-
; (as-> rc
765-
; (let [sct (get-in rc [:AssociatedDOIs :Type])]
766-
; (if (or (= "IsPreviousVersionOf" sct)
767-
; (= "IsNewVersionOf" sct))
768-
; (update-in rc [:AssociatedDOIs] dissoc :Type)
769-
; rc)))
770-
; ;; Change CollectionProgress enum to NOT APPLICABLE if its value is PREPRINT, INREVIEW, or SUPERSEDED
771-
; (let [CollectionProgress (:CollectionProgress collection)]
772-
; (if (or (= "PREPRINT" CollectionProgress) (= "INREVIEW" CollectionProgress) (= "SUPERSEDED" CollectionProgress))
773-
; (assoc collection :CollectionProgress "NOT APPLICABLE")
774-
; collection)))))
751+
(m-spec/update-version collection :collection "1.18.2")
752+
;; Change CollectionProgress to "NOT PROVIDED" if its value is "NOT APPLICABLE"
753+
(let [CollectionProgress (:CollectionProgress collection)]
754+
(if (or (= "NOT APPLICABLE" CollectionProgress))
755+
(assoc collection :CollectionProgress "NOT PROVIDED")
756+
collection)))
757+
758+
(defmethod interface/migrate-umm-version [:collection "1.18.2" "1.18.1"]
759+
[_context collection & _]
760+
;; Migrating down version 1.18.2 to 1.18.1
761+
;; Remove AssociatedDOIs/Type enums: IsPreviousVersionOf and IsNewVersionOf
762+
;; Remove PREPRINT, INREVIEW, and SUPERSEDED enums to CollectionProgress
763+
;; Add back in NOT APPLICABLE enum in CollectionProgress
764+
(m-spec/update-version collection :collection "1.18.1")
765+
;; Change AssociatedDOIs/Type to 'Related Dataset' if its enum value is IsPreviousVersionOf and IsNewVersionOf
766+
;; TODO
767+
;(as-> rc
768+
; (let [sct (get-in rc [:AssociatedDOIs :Type])]
769+
; (if (or (= "IsPreviousVersionOf" sct)
770+
; (= "IsNewVersionOf" sct))
771+
; (update-in rc [:AssociatedDOIs] dissoc :Type)
772+
; rc)))
773+
;; Change CollectionProgress enum to COMPLETED if its enum value is PREPRINT, INREVIEW, or SUPERSEDED
774+
(let [CollectionProgress (:CollectionProgress collection)]
775+
(if (or (= "PREPRINT" CollectionProgress)
776+
(= "INREVIEW" CollectionProgress)
777+
(= "SUPERSEDED" CollectionProgress))
778+
(assoc collection :CollectionProgress "COMPLETED")
779+
collection)))

0 commit comments

Comments
 (0)