0
0

Fix pipes modifiers

This commit is contained in:
Serghei Cebotari 2023-10-03 21:58:06 +03:00
parent c8d55895bb
commit 28f85e5c9d
3 changed files with 8 additions and 8 deletions

View File

@ -2,13 +2,13 @@ namespace RhSolutions.Api.Services
{ {
public class BlackPipeQueryModifier : FlexPipeQueryModifier public class BlackPipeQueryModifier : FlexPipeQueryModifier
{ {
protected override string diameterPattern => @"16|20|25"; protected override string diameterPattern => @"\b(16|20|25)\b";
protected override string pipeName => "Black"; protected override string pipeName => "Black";
protected override Dictionary<string, string> diameterNames => new() protected override Dictionary<string, string> diameterNames => new()
{ {
["16"] = "16х2,2", ["16"] = "16х2,2",
["20"] = "20х2,8", ["20"] = "20х2,8",
["25"] = "25х3,5" ["25"] = "25х3,5"
}; };
} }
} }

View File

@ -6,8 +6,8 @@ namespace RhSolutions.Api.Services
{ {
public class FlexPipeQueryModifier : IProductQueryModifier public class FlexPipeQueryModifier : IProductQueryModifier
{ {
protected virtual string diameterPattern { get; } = @"16|20|25|32|40|50|63"; protected virtual string diameterPattern { get; } = @"\b(16|20|25|32|40|50|63)\b";
protected virtual string typePattern { get; } = @"(бухт)|(отр)"; protected virtual string typePattern { get; } = @"бухт|отр|штанг";
protected virtual string pipeName { get; } = "Flex"; protected virtual string pipeName { get; } = "Flex";
protected virtual Dictionary<string, string> diameterNames { get; } = new() protected virtual Dictionary<string, string> diameterNames { get; } = new()
{ {
@ -47,13 +47,13 @@ namespace RhSolutions.Api.Services
if (typeMatches.Count > 0) if (typeMatches.Count > 0)
{ {
var type = typeMatches.First().Value; var type = typeMatches.First().Value;
if (type.StartsWith("бухт")) if (type.StartsWith("отр") || type.StartsWith("штанг"))
{ {
sb.Append("бухта"); sb.Append("прям.отрезки");
} }
else else
{ {
sb.Append("прям.отрезки"); sb.Append("бухта");
} }
} }
else if (int.Parse(diameter) < 32) else if (int.Parse(diameter) < 32)

View File

@ -2,7 +2,7 @@ namespace RhSolutions.Api.Services
{ {
public class StabilPipeQueryModifier : FlexPipeQueryModifier public class StabilPipeQueryModifier : FlexPipeQueryModifier
{ {
protected override string diameterPattern => @"16|20|25|32|40"; protected override string diameterPattern => @"\b(16|20|25|32|40)\b";
protected override string pipeName => "Stabil -PLATINUM"; protected override string pipeName => "Stabil -PLATINUM";
protected override Dictionary<string, string> diameterNames => new() protected override Dictionary<string, string> diameterNames => new()
{ {