improvements, fixes

This commit is contained in:
Loretta 2024-11-26 07:26:12 +01:00
parent 5a0031f9a4
commit 1953c6d9ba
3 changed files with 15 additions and 12 deletions

View File

@ -52,6 +52,7 @@ public class ProductToAuctionDto : IProductToAuctionDto
CurrentPrice = productToAuction.CurrentPrice;
ProductAmount = productToAuction.ProductAmount;
SortIndex = productToAuction.SortIndex;
WinnerCustomerId = productToAuction.WinnerCustomerId;
}
public ProductToAuctionMapping CreateMainEntity()
@ -66,6 +67,7 @@ public class ProductToAuctionDto : IProductToAuctionDto
mainEntity.CurrentPrice = CurrentPrice;
mainEntity.ProductAmount = ProductAmount;
mainEntity.SortIndex = SortIndex;
mainEntity.WinnerCustomerId = WinnerCustomerId;
return mainEntity;
}

View File

@ -114,7 +114,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs
return;
}
await SetAuctionBidPrice(revertLastBid.BidPrice, productToAuction, product);
await SetAuctionBidPrice(revertLastBid.BidPrice, productToAuction, product, revertLastBid.CustomerId);
await SendAuctionBidMessageAsync(revertLastBid, productToAuction, product, customer.Id);
}
catch (Exception ex)
@ -236,7 +236,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs
var activeProductAuction = (await auctionService.GetProductToAuctionByAuctionIdAndProductIdAsync(bidRequestMessage.AuctionId, bidRequestMessage.ProductId, true)).FirstOrDefault();
if (activeProductAuction is not { IsActiveItem: true } || activeProductAuction.WinnerCustomerId == customer.Id)
{
logger.Warning($"SignalRMessageHandler.HandleBidRequest(); (activeProductAuction is not {{ IsActiveItem: true }} || activeProductAuction.WinnerCustomerId == customer.Id); AuctionStatus: {activeProductAuction?.AuctionStatus}; WinnerCustomerId: {activeProductAuction?.WinnerCustomerId}", null, customer);
logger.Warning($"SignalRMessageHandler.HandleBidRequest(); (activeProductAuction is not {{ IsActiveItem: true }}); AuctionStatus: {activeProductAuction?.AuctionStatus};", null, customer);
return; //TODO: - J.
}
@ -257,7 +257,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs
await auctionService.InsertBidAsync(auctionBid);
activeProductAuction.AuctionStatus = AuctionStatus.Active;
if (!await SetAuctionBidPrice(bidRequestMessage.BidPrice, activeProductAuction, product)) return;
if (!await SetAuctionBidPrice(bidRequestMessage.BidPrice, activeProductAuction, product, customer.Id)) return;
await SendAuctionBidMessageAsync(auctionBid, activeProductAuction, product, customer.Id);
}
@ -289,7 +289,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs
await hubContext.Clients.All.SendAsync("send", bidMessage.ToJson());
}
private async Task<bool> SetAuctionBidPrice(decimal bidPrice, ProductToAuctionMapping productToAuction, Product product)
private async Task<bool> SetAuctionBidPrice(decimal bidPrice, ProductToAuctionMapping productToAuction, Product product, int lastBidCustomerId)
{
try
{
@ -298,6 +298,7 @@ namespace Nop.Plugin.Misc.AuctionPlugin.Hubs
//activeProductAuction.StartingPrice = product.OldPrice; //TODO: ez biztosan kezelve van mikor összerendeljük? - J.
productToAuction.CurrentPrice = product.Price;
productToAuction.WinnerCustomerId = lastBidCustomerId;
await auctionService.UpdateProductToAuctionMappingAsync(productToAuction);
return true;

View File

@ -394,14 +394,14 @@
signalRResetItemButton: true,
},
[AuctionStatus.Pause]: {
signalRBidButton: true,
signalRFirstWarningButton: true,
signalRSecondWarningButton: true,
signalROpenItemButton: false,
signalRCloseItemButton: true,
signalRPauseItemButton: true,
signalRRevertBidButton: true,
signalRResetItemButton: true,
signalRBidButton: true,
signalRFirstWarningButton: true,
signalRSecondWarningButton: true,
signalROpenItemButton: false,
signalRCloseItemButton: true,
signalRPauseItemButton: true,
signalRRevertBidButton: false,
signalRResetItemButton: false,
},
[AuctionStatus.Sold]: {
signalRBidButton: true,