Skip to content

Commit 44dcfb2

Browse files
committed
CMR-10528: fixes bug with feature toggle
1 parent 16e4616 commit 44dcfb2

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

‎search-app/src/cmr/search/services/parameters/conversion.clj‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,15 @@
272272

273273
(defmethod common-params/parameter->condition :include-non-operational
274274
[_context _concept-type _param value _options]
275-
;; When include-non-operational=false, restrict results to active collections only.
276-
;; When true or unset, return all collections.
277-
(let [v (when value (string/lower-case value))]
278-
(if (= "false" v)
279-
(cqm/boolean-condition :collection-progress-active true)
280-
cqm/match-all)))
275+
;; Only apply filtering when the feature flag is enabled.
276+
;; When include-non-operational=false AND flag is on, restrict results to active collections only.
277+
;; When true or unset or flag is off, return all collections.
278+
(if (config/enable-non-operational-collection-filter)
279+
(let [v (when value (string/lower-case value))]
280+
(if (= "false" v)
281+
(cqm/boolean-condition :collection-progress-active true)
282+
cqm/match-all))
283+
cqm/match-all))
281284

282285
(def collection-only-params
283286
"List of parameters that are valid in collection query models, but not in granule query models."

‎system-int-test/test/cmr/system_int_test/search/collection/collection_progress_search_test.clj‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@
6565
(d/refs-match? [coll1 coll2 coll3 coll4 coll5 coll6 coll7 coll8]
6666
(search/find-refs :collection {})))
6767

68+
(testing "flag OFF + include-non-operational=false - all 8 collections returned (param ignored when flag off)"
69+
(d/refs-match? [coll1 coll2 coll3 coll4 coll5 coll6 coll7 coll8]
70+
(search/find-refs :collection {:include-non-operational "false"})))
71+
72+
(testing "flag OFF + include-non-operational=true - all 8 collections returned (param ignored when flag off)"
73+
(d/refs-match? [coll1 coll2 coll3 coll4 coll5 coll6 coll7 coll8]
74+
(search/find-refs :collection {:include-non-operational "true"})))
75+
6876
(side/eval-form `(cmr.search.config/set-enable-non-operational-collection-filter! true))
6977

7078
(testing "flag ON, no params - only active collections returned (excludes PLANNED, DEPRECATED, PREPRINT, INREVIEW)"

0 commit comments

Comments
 (0)