Skip to content

Commit

Permalink
fix variation name issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Heihokon committed Sep 14, 2023
1 parent d83063e commit 07d2b1c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 33 deletions.
65 changes: 33 additions & 32 deletions Flagship/Decision/DecisionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,53 +19,54 @@ internal abstract class DecisionManager : IDecisionManager
protected bool _isPanic = false;

public FlagshipConfig Config { get; set; }
public bool IsPanic {
get => _isPanic;
protected set {
public bool IsPanic
{
get => _isPanic;
protected set
{
_isPanic = value;
StatusChange?.Invoke(_isPanic ? FlagshipStatus.READY_PANIC_ON : FlagshipStatus.READY);
}
}

public HttpClient HttpClient { get ; set ; }
public HttpClient HttpClient { get; set; }

public DecisionManager(FlagshipConfig config, HttpClient httpClient)
{
Config = config;
Config = config;
HttpClient = httpClient;
}

abstract public Task<ICollection<Campaign>> GetCampaigns(VisitorDelegateAbstract visitor);

public Task<ICollection<FlagDTO>> GetFlags(ICollection<Campaign> campaigns)
{
return Task.Factory.StartNew(() =>
{
ICollection<FlagDTO> flags = new Collection<FlagDTO>();
foreach (var campaign in campaigns)
{
foreach (var item in campaign.Variation.Modifications.Value)
{
var variationName = campaign.Type == "ab" ? campaign.Variation.Name : campaign.VariationGroupName;
var flag = new FlagDTO()
{
Key = item.Key,
CampaignId = campaign.Id,
CampaignName = campaign.Name,
VariationGroupId = campaign.VariationGroupId,
VariationGroupName = campaign.VariationGroupName,
VariationId = campaign.Variation.Id,
VariationName = variationName,
IsReference = campaign.Variation.Reference,
Value = item.Value,
CampaignType = campaign.Type,
Slug = campaign.Slug
};
flags.Add(flag);
}
}
return flags;
});
return Task.Factory.StartNew(() =>
{
ICollection<FlagDTO> flags = new Collection<FlagDTO>();
foreach (var campaign in campaigns)
{
foreach (var item in campaign.Variation.Modifications.Value)
{
var flag = new FlagDTO()
{
Key = item.Key,
CampaignId = campaign.Id,
CampaignName = campaign.Name,
VariationGroupId = campaign.VariationGroupId,
VariationGroupName = campaign.VariationGroupName,
VariationId = campaign.Variation.Id,
VariationName = campaign.Variation.Name,
IsReference = campaign.Variation.Reference,
Value = item.Value,
CampaignType = campaign.Type,
Slug = campaign.Slug
};
flags.Add(flag);
}
}
return flags;
});
}
}
}
2 changes: 1 addition & 1 deletion Flagship/Flagship.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Authors>Flagship Team</Authors>
<Company>ABTasty</Company>
<Product>Flagship</Product>
<Version>3.1.1</Version>
<Version>3.1.2</Version>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<PackageProjectUrl>https://github.com/flagship-io/flagship-dotnet-sdk</PackageProjectUrl>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
Expand Down

0 comments on commit 07d2b1c

Please sign in to comment.