File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 11[submodule "tests/engine_tests/engine-test-data "]
22 path = tests/engine_tests/engine-test-data
33 url = https://github.com/flagsmith/engine-test-data.git
4- tag = v2.2.0
4+ branch = feat/variant-priority-sorting
Original file line number Diff line number Diff line change @@ -131,12 +131,12 @@ def get_flag_result_from_feature_context(
131131 [feature_context ["key" ], key ]
132132 )
133133
134- # We expect `variants` to be pre-sorted in order of persistence. This gives us a
135- # way to ensure that the same value is returned every time we use the same
136- # percentage value.
137134 start_percentage = 0.0
138135
139- for variant in variants :
136+ for variant in sorted (
137+ variants ,
138+ key = operator .itemgetter ("priority" ),
139+ ):
140140 limit = (weight := variant ["weight" ]) + start_percentage
141141 if start_percentage <= percentage_value < limit :
142142 return {
You can’t perform that action at this time.
0 commit comments