Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: experimentRules should have same order as experimentIds #279

Merged
merged 5 commits into from
Sep 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- stage: 'Unit Tests'
language: csharp
dist: xenial
mono: 5.2.0
mono: 6.12.0
solution: "./OptimizelySDK.Travis.sln"
install:
- nuget restore ./OptimizelySDK.Travis.sln
Expand All @@ -67,9 +67,9 @@ jobs:
- stage: 'NetStandard16'
language: csharp
# dotnet only works on trusty https://github.com/travis-ci/travis-ci/issues/5189
dist: trusty
dist: xenial
mono: none
dotnet: 2.1.502
dotnet: 3.1
install:
- dotnet restore OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj
script:
Expand All @@ -84,9 +84,9 @@ jobs:
- stage: 'NetStandard20'
language: csharp
# dotnet only works on trusty https://github.com/travis-ci/travis-ci/issues/5189
dist: trusty
dist: xenial
mono: none
dotnet: 2.1.502
dotnet: 3.1
install:
- dotnet restore OptimizelySDK.NetStandard20/OptimizelySDK.NetStandard20.csproj
script:
Expand Down
5 changes: 2 additions & 3 deletions OptimizelySDK/OptlyConfig/OptimizelyConfigService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,11 @@ private IDictionary<string, OptimizelyFeature> GetFeaturesMap(ProjectConfig proj
foreach (var featureFlag in projectConfig.FeatureFlags)
{

var featureExperimentMap = experimentsMapById.Where(expMap => featureFlag.ExperimentIds.Contains(expMap.Key))
.ToDictionary(k => k.Value.Key, v => v.Value);
var experimentRules = featureFlag.ExperimentIds.Select(experimentId => experimentsMapById[experimentId]).ToList();

var featureVariableMap = featureFlag.Variables.Select(v => (OptimizelyVariable)v).ToDictionary(k => k.Key, v => v) ?? new Dictionary<string, OptimizelyVariable>();

var experimentRules = featureExperimentMap.Select(exMap => exMap.Value).ToList();
var featureExperimentMap = experimentRules.ToDictionary(experiment => experiment.Key, experiment => experiment);
var rollout = projectConfig.GetRolloutFromId(featureFlag.RolloutId);
var deliveryRules = GetDeliveryRules(featureFlag.Id, rollout.Experiments, projectConfig);

Expand Down