MCPcopy Index your code
hub / github.com/Flagsmith/flagsmith / _create_rollout_segment

Function _create_rollout_segment

api/experimentation/services.py:530–545  ·  view source on GitHub ↗
(
    experiment: Experiment, rollout_percentage: float
)

Source from the content-addressed store, hash-verified

528
529
530def _create_rollout_segment(
531 experiment: Experiment, rollout_percentage: float
532) -> Segment:
533 segment: Segment = Segment.objects.create(
534 name=f"experiment-{experiment.id}-rollout",
535 project=experiment.feature.project,
536 is_system_segment=True,
537 )
538 rule = SegmentRule.objects.create(segment=segment, type=SegmentRule.ALL_RULE)
539 Condition.objects.create(
540 rule=rule,
541 operator=PERCENTAGE_SPLIT,
542 property="$.identity.key",
543 value=str(rollout_percentage),
544 )
545 return segment
546
547
548def validate_rollout_spec(experiment: Experiment, spec: RolloutSpec) -> None:

Callers 1

_sync_rollout_segmentFunction · 0.85

Calls 1

createMethod · 0.45

Tested by

no test coverage detected