Skip to content

Commit c9b4b80

Browse files
committed
feat: Support variant priority
1 parent 68d44a1 commit c9b4b80

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
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 (
@@ -245,11 +245,14 @@ def _map_environment_document_feature_states_to_feature_contexts(
245245
"multivariate_feature_option"
246246
]["value"],
247247
"weight": multivariate_feature_state_value["percentage_allocation"],
248+
"priority": (
249+
multivariate_feature_state_value.get("id")
250+
or uuid.UUID(
251+
multivariate_feature_state_value["mv_fs_value_uuid"]
252+
).int
253+
),
248254
}
249-
for multivariate_feature_state_value in sorted(
250-
multivariate_feature_state_values,
251-
key=itemgetter("id"),
252-
)
255+
for multivariate_feature_state_value in multivariate_feature_state_values
253256
]
254257
if (
255258
priority := (feature_state.get("feature_segment") or {}).get("priority")

poetry.lock

Lines changed: 3 additions & 3 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
@@ -13,7 +13,7 @@ packages = [{ include = "flagsmith" }]
1313
python = ">=3.9,<4"
1414
requests = "^2.32.3"
1515
requests-futures = "^1.0.1"
16-
flagsmith-flag-engine = { git = "https://github.com/Flagsmith/flagsmith-engine.git", branch = "feat/generic-metadata" }
16+
flagsmith-flag-engine = { git = "https://github.com/Flagsmith/flagsmith-engine.git", branch = "feat/variants-priority" }
1717
sseclient-py = "^1.8.0"
1818

1919
[tool.poetry.group.dev]

0 commit comments

Comments
 (0)