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

VP-2649: Fix Sonar cube critical bugs that prevent build on CI #428

Merged
merged 3 commits into from
Jun 2, 2020
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
4 changes: 2 additions & 2 deletions VirtoCommerce.Storefront.Model/Common/Money/Currency.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.Serialization;
using Newtonsoft.Json;

namespace VirtoCommerce.Storefront.Model.Common
{
Expand All @@ -23,6 +22,7 @@ static Currency()
}
catch (Exception)
{
// No actions needed
}
}
}
Expand Down
7 changes: 2 additions & 5 deletions VirtoCommerce.Storefront/Domain/Catalog/CatalogConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,9 @@ public static CatalogProperty ToProperty(this catalogDto.Property propertyDto, L
}

//For multilingual properties need populate LocalizedValues collection and set value for requested language
if (propertyDto.Multilanguage ?? false)
if ((propertyDto.Multilanguage ?? false) && propertyDto.Values != null)
Copy link
Contributor

@vc-ci vc-ci May 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR Change this condition so that it does not always evaluate to 'false'. rule

{
if (propertyDto.Values != null)
{
result.LocalizedValues = propertyDto.Values.Where(x => x.Value != null).Select(x => new LocalizedString(new Language(x.LanguageCode), x.Value.ToString())).ToList();
}
result.LocalizedValues = propertyDto.Values.Where(x => x.Value != null).Select(x => new LocalizedString(new Language(x.LanguageCode), x.Value.ToString())).ToList();
}

//Set property value
Expand Down
12 changes: 6 additions & 6 deletions VirtoCommerce.Storefront/Domain/Marketing/MarketingConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
using VirtoCommerce.Storefront.Model.Catalog;
using VirtoCommerce.Storefront.Model.Common;
using VirtoCommerce.Storefront.Model.Marketing;
using platformDto = VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models;
using marketingDto = VirtoCommerce.Storefront.AutoRestClients.MarketingModuleApi.Models;
using platformDto = VirtoCommerce.Storefront.AutoRestClients.PlatformModuleApi.Models;

namespace VirtoCommerce.Storefront.Domain
{
Expand Down Expand Up @@ -114,11 +114,11 @@ public static marketingDto.DynamicContentEvaluationContext ToDynamicContentEvalu
var result = new marketingDto.DynamicContentEvaluationContext
{
UserGroups = dynamicContentEvalContext?.User?.Contact?.UserGroups,
Language = dynamicContentEvalContext.Language != null ? dynamicContentEvalContext.Language.CultureName : null,
StoreId = dynamicContentEvalContext.StoreId,
Tags = dynamicContentEvalContext.Tags,
ToDate = dynamicContentEvalContext.ToDate,
PlaceName = dynamicContentEvalContext.PlaceName
Language = dynamicContentEvalContext?.Language != null ? dynamicContentEvalContext.Language.CultureName : null,
StoreId = dynamicContentEvalContext?.StoreId,
Tags = dynamicContentEvalContext?.Tags,
ToDate = dynamicContentEvalContext?.ToDate,
PlaceName = dynamicContentEvalContext?.PlaceName
};
return result;
}
Expand Down