2021-08-09 18:32:16 +00:00
|
|
|
using Microsoft.AspNetCore.Builder;
|
2021-08-05 06:22:19 +00:00
|
|
|
using Props.Shop.Framework;
|
|
|
|
|
|
|
|
namespace Props.Extensions
|
|
|
|
{
|
|
|
|
public static class ProductListingExtensions
|
|
|
|
{
|
|
|
|
public static float? GetRatingToPriceRatio(this ProductListing productListing)
|
|
|
|
{
|
|
|
|
int reviewFactor = productListing.ReviewCount.HasValue ? productListing.ReviewCount.Value : 1;
|
|
|
|
int purchaseFactor = productListing.PurchaseCount.HasValue ? productListing.PurchaseCount.Value : 1;
|
|
|
|
return (productListing.Rating * (reviewFactor > purchaseFactor ? reviewFactor : purchaseFactor)) / (productListing.LowerPrice * productListing.UpperPrice);
|
|
|
|
}
|
2021-08-09 18:32:16 +00:00
|
|
|
|
|
|
|
|
2021-08-05 06:22:19 +00:00
|
|
|
}
|
|
|
|
}
|