This commit is contained in:
Anton Suhorukov 2023-03-29 15:19:32 +03:00
parent f1427e0b97
commit 4bda4e2d79

View File

@ -58,13 +58,13 @@ public class QuotaHelper
var priceInfo = _tenantManager.GetProductPriceInfo(); var priceInfo = _tenantManager.GetProductPriceInfo();
var currentRegion = _regionHelper.GetCurrentRegionInfo(); var currentRegion = _regionHelper.GetCurrentRegionInfo();
return await ToQuotaDto(quota, priceInfo, currentRegion, true, true); return await ToQuotaDto(quota, priceInfo, currentRegion, true);
} }
private async Task<QuotaDto> ToQuotaDto(TenantQuota quota, IDictionary<string, Dictionary<string, decimal>> priceInfo, RegionInfo currentRegion, bool getUsed = false, bool visible = false) private async Task<QuotaDto> ToQuotaDto(TenantQuota quota, IDictionary<string, Dictionary<string, decimal>> priceInfo, RegionInfo currentRegion, bool getUsed = false)
{ {
var price = GetPrice(quota, priceInfo, currentRegion); var price = GetPrice(quota, priceInfo, currentRegion);
var features = await GetFeatures(quota, getUsed, visible).ToListAsync(); var features = await GetFeatures(quota, getUsed).ToListAsync();
return new QuotaDto return new QuotaDto
{ {
@ -98,13 +98,13 @@ public class QuotaHelper
return quota.Price; return quota.Price;
} }
private async IAsyncEnumerable<TenantQuotaFeatureDto> GetFeatures(TenantQuota quota, bool getUsed, bool visible) private async IAsyncEnumerable<TenantQuotaFeatureDto> GetFeatures(TenantQuota quota, bool getUsed)
{ {
var assembly = GetType().Assembly; var assembly = GetType().Assembly;
var features = quota.Features.Split(' ', ',', ';'); var features = quota.Features.Split(' ', ',', ';');
foreach (var feature in quota.TenantQuotaFeatures.Where(r => visible || r.Visible).OrderBy(r => r.Order)) foreach (var feature in quota.TenantQuotaFeatures.Where(r => r.Visible).OrderBy(r => r.Order))
{ {
var result = new TenantQuotaFeatureDto() var result = new TenantQuotaFeatureDto()
{ {