Skip to content

Commit 4f84044

Browse files
authored
feat: Support variant priority (#161)
1 parent 374e292 commit 4f84044

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

flagsmith/mappers.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import json
22
import typing
3+
import uuid
34
from collections import defaultdict
45
from datetime import datetime, timezone
5-
from operator import itemgetter
66

77
import sseclient
88
from flag_engine.context.types import (
@@ -250,11 +250,14 @@ def _map_environment_document_feature_states_to_feature_contexts(
250250
"multivariate_feature_option"
251251
]["value"],
252252
"weight": multivariate_feature_state_value["percentage_allocation"],
253+
"priority": (
254+
multivariate_feature_state_value.get("id")
255+
or uuid.UUID(
256+
multivariate_feature_state_value["mv_fs_value_uuid"]
257+
).int
258+
),
253259
}
254-
for multivariate_feature_state_value in sorted(
255-
multivariate_feature_state_values,
256-
key=itemgetter("id"),
257-
)
260+
for multivariate_feature_state_value in multivariate_feature_state_values
258261
]
259262

260263
if "feature_segment" in feature_state:

poetry.lock

Lines changed: 6 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ documentation = "https://docs.flagsmith.com"
1010
packages = [{ include = "flagsmith" }]
1111

1212
[tool.poetry.dependencies]
13-
flagsmith-flag-engine = { git = "https://github.com/Flagsmith/flagsmith-engine.git", branch = "feat/generic-metadata" }
13+
flagsmith-flag-engine = "^9.0.0"
1414
python = ">=3.9,<4"
1515
requests = "^2.32.3"
1616
requests-futures = "^1.0.1"

0 commit comments

Comments
 (0)