diff --git a/auto-bid-server/src/modules/mails/services/mails.service.ts b/auto-bid-server/src/modules/mails/services/mails.service.ts index 9fe68d4..3d76558 100644 --- a/auto-bid-server/src/modules/mails/services/mails.service.ts +++ b/auto-bid-server/src/modules/mails/services/mails.service.ts @@ -360,15 +360,23 @@ export class MailsService { } getBidSubmittedEmailContent(bid: Bid): string { + const histories = _.orderBy(bid.histories || [], ['price'], ['desc']); + const webname = extractDomain(bid.web_bid.origin_url); const title = `[${webname}] ${bid.name || 'Unnamed Item'}`; const endTime = formatEndTime(bid.close_time, false); const competitor = `$${bid.current_price}`; const max = `$${bid.max_price}`; - const submitted = `$${bid.max_price}`; - const maxReached = bid.max_price <= bid.max_price; + const submitted = + bid.max_price == histories[0]?.price + ? `$${bid.max_price}` + : `$${histories[0]?.price}`; + const maxReached = bid.max_price == histories[0]?.price; + // const maxReached = bid.max_price <= bid.max_price; const from = process.env.MAIL_USER || 'no-reply@example.com'; + console.log({ histories, maxReached, submitted }); + return `