Skip to content

Commit

Permalink
VCST-2608: Fix range aggregations (#30)
Browse files Browse the repository at this point in the history
* fix: Add missing range aggregation mapper

* Support fractional range bounds

* Test e2e with alfa dependencies

* Fix alfa version in module.manifest

* Make range bounds nullable

* Update dependencies

---------

Co-authored-by: Andrew <56427313+AndrewEhlo@users.noreply.github.com>
  • Loading branch information
artem-dudarev and AndrewEhlo authored Feb 6, 2025
1 parent 71a87b9 commit c5ffc8c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/module-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ jobs:
if: ${{ ((github.ref == 'refs/heads/dev') && (github.event_name == 'push') && (needs.ci.outputs.run-e2e == 'true')) ||
(github.event_name == 'workflow_dispatch') || (github.base_ref == 'dev') && (github.event_name == 'pull_request') }}
needs: 'ci'
uses: VirtoCommerce/.github/.github/workflows/e2e.yml@v3.800.11
# uses: VirtoCommerce/.github/.github/workflows/e2e.yml@v3.800.11
uses: VirtoCommerce/.github/.github/workflows/e2e.yml@VCST-2469

with:
katalonRepo: 'VirtoCommerce/vc-quality-gate-katalon'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageReference Include="VirtoCommerce.Xapi.Core" Version="3.900.0" />
<PackageReference Include="VirtoCommerce.Xapi.Core" Version="3.903.0" />
<PackageReference Include="VirtoCommerce.CatalogModule.Core" Version="3.839.0" />
<PackageReference Include="VirtoCommerce.InventoryModule.Core" Version="3.805.0" />
<PackageReference Include="VirtoCommerce.MarketingModule.Core" Version="3.815.0" />
Expand Down
17 changes: 14 additions & 3 deletions src/VirtoCommerce.XCatalog.Data/Mapping/FacetMappingProfile.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Globalization;
using System.Linq;
using AutoMapper;
using VirtoCommerce.CatalogModule.Core.Model.Search;
Expand Down Expand Up @@ -30,15 +31,15 @@ public FacetMappingProfile()
.ToArray() ?? [],
Name = request.Field
},
"pricerange" => new CoreFacets.RangeFacetResult
"range" or "pricerange" => new CoreFacets.RangeFacetResult
{
Ranges = request.Items?.Select(x => new CoreFacets.FacetRange
{
Count = x.Count,
From = Convert.ToInt64(x.RequestedLowerBound),
From = ToNullableDecimal(x.RequestedLowerBound),
IncludeFrom = x.IncludeLower,
FromStr = x.RequestedLowerBound,
To = Convert.ToInt64(x.RequestedUpperBound),
To = ToNullableDecimal(x.RequestedUpperBound),
IncludeTo = x.IncludeUpper,
ToStr = x.RequestedUpperBound,
IsSelected = x.IsApplied,
Expand All @@ -58,5 +59,15 @@ public FacetMappingProfile()
return result;
});
}

private static decimal? ToNullableDecimal(string value)
{
if (string.IsNullOrWhiteSpace(value))
{
return null;
}

return Convert.ToDecimal(value, CultureInfo.InvariantCulture);
}
}
}
2 changes: 1 addition & 1 deletion src/VirtoCommerce.XCatalog.Web/module.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<dependency id="VirtoCommerce.Inventory" version="3.805.0" optional="true" />
<dependency id="VirtoCommerce.Marketing" version="3.815.0" optional="true" />
<dependency id="VirtoCommerce.Pricing" version="3.809.0" optional="true" />
<dependency id="VirtoCommerce.Xapi" version="3.900.0" />
<dependency id="VirtoCommerce.Xapi" version="3.903.0" />
</dependencies>

<title>Catalog Experience API</title>
Expand Down

0 comments on commit c5ffc8c

Please sign in to comment.