MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / _get_previous_feature_state_for_change_request

Function _get_previous_feature_state_for_change_request

api/features/tasks.py:89–115  ·  view source on GitHub ↗

Find the previous live FeatureState for a change request (legacy versioning).

(
    instance: FeatureState,
)

Source from the content-addressed store, hash-verified

87
88
89def _get_previous_feature_state_for_change_request(
90 instance: FeatureState,
91) -> FeatureState | None:
92 """Find the previous live FeatureState for a change request (legacy versioning)."""
93 result: FeatureState | None = (
94 FeatureState.objects.exclude(
95 change_request_id=instance.change_request_id,
96 )
97 .filter(
98 environment_id=instance.environment_id,
99 feature_id=instance.feature_id,
100 feature_segment=instance.feature_segment,
101 identity=instance.identity,
102 version__isnull=False,
103 live_from__lt=instance.live_from,
104 )
105 .order_by("-live_from")
106 .select_related(
107 "feature",
108 "environment",
109 "feature_state_value",
110 "feature_segment",
111 "identity",
112 )
113 .first()
114 )
115 return result
116
117
118def _get_feature_state_webhook_data(

Callers 1

_get_previous_stateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…