@@ -393,47 +393,47 @@ private List<Experiment> injectFeatureRolloutVariations(
393393
394394 List <Experiment > updatedExperiments = new ArrayList <>(allExperiments );
395395
396- // for (FeatureFlag flag : featureFlags) {
397- // Variation everyoneElseVariation = getEveryoneElseVariation(flag, rolloutMap);
398- // if (everyoneElseVariation == null) {
399- // continue;
400- // }
401-
402- // for (String experimentId : flag.getExperimentIds()) {
403- // Integer index = experimentIndexMap.get(experimentId);
404- // if (index == null) {
405- // continue;
406- // }
407- // Experiment experiment = updatedExperiments.get(index);
408- // if (!Experiment.TYPE_FR.equals(experiment.getType())) {
409- // continue;
410- // }
411-
412- // // Create new experiment with injected variation and traffic allocation
413- // List<Variation> newVariations = new ArrayList<>(experiment.getVariations());
414- // newVariations.add(everyoneElseVariation);
415-
416- // List<TrafficAllocation> newTrafficAllocation = new ArrayList<>(experiment.getTrafficAllocation());
417- // newTrafficAllocation.add(new TrafficAllocation(everyoneElseVariation.getId(), 10000));
418-
419- // Experiment updatedExperiment = new Experiment(
420- // experiment.getId(),
421- // experiment.getKey(),
422- // experiment.getStatus(),
423- // experiment.getLayerId(),
424- // experiment.getAudienceIds(),
425- // experiment.getAudienceConditions(),
426- // newVariations,
427- // experiment.getUserIdToVariationKeyMap(),
428- // newTrafficAllocation,
429- // experiment.getGroupId(),
430- // experiment.getCmab(),
431- // experiment.getType()
432- // );
433-
434- // updatedExperiments.set(index, updatedExperiment);
435- // }
436- // }
396+ for (FeatureFlag flag : featureFlags ) {
397+ Variation everyoneElseVariation = getEveryoneElseVariation (flag , rolloutMap );
398+ if (everyoneElseVariation == null ) {
399+ continue ;
400+ }
401+
402+ for (String experimentId : flag .getExperimentIds ()) {
403+ Integer index = experimentIndexMap .get (experimentId );
404+ if (index == null ) {
405+ continue ;
406+ }
407+ Experiment experiment = updatedExperiments .get (index );
408+ if (!Experiment .TYPE_FR .equals (experiment .getType ())) {
409+ continue ;
410+ }
411+
412+ // Create new experiment with injected variation and traffic allocation
413+ List <Variation > newVariations = new ArrayList <>(experiment .getVariations ());
414+ newVariations .add (everyoneElseVariation );
415+
416+ List <TrafficAllocation > newTrafficAllocation = new ArrayList <>(experiment .getTrafficAllocation ());
417+ newTrafficAllocation .add (new TrafficAllocation (everyoneElseVariation .getId (), 10000 ));
418+
419+ Experiment updatedExperiment = new Experiment (
420+ experiment .getId (),
421+ experiment .getKey (),
422+ experiment .getStatus (),
423+ experiment .getLayerId (),
424+ experiment .getAudienceIds (),
425+ experiment .getAudienceConditions (),
426+ newVariations ,
427+ experiment .getUserIdToVariationKeyMap (),
428+ newTrafficAllocation ,
429+ experiment .getGroupId (),
430+ experiment .getCmab (),
431+ experiment .getType ()
432+ );
433+
434+ updatedExperiments .set (index , updatedExperiment );
435+ }
436+ }
437437
438438 return updatedExperiments ;
439439 }
0 commit comments