update start time when close time change

This commit is contained in:
Admin 2026-03-04 10:11:31 +07:00
parent c32b7545c2
commit 83a2f16563
2 changed files with 16 additions and 3 deletions

View File

@ -403,10 +403,23 @@ export class BidsService {
bid.close_time = close_time; bid.close_time = close_time;
bid.close_time_ts = new Date(close_time); bid.close_time_ts = new Date(close_time);
const arrival_offset_seconds =
this.bidMetadatasService.getArrivalOffsetSecondsByMode(bid.metadata) ||
bid.web_bid.arrival_offset_seconds;
bid.start_bid_time = subtractMinutes(
close_time,
arrival_offset_seconds / 60,
);
// update // update
await this.bidsRepo.update( await this.bidsRepo.update(
{ id }, { id },
{ close_time: bid.close_time, close_time_ts: bid.close_time_ts }, {
close_time: bid.close_time,
close_time_ts: bid.close_time_ts,
start_bid_time: bid.start_bid_time,
},
); );
bid = await this.getBidForClientUpdate(id); bid = await this.getBidForClientUpdate(id);

View File

@ -207,8 +207,6 @@ export class AllbidsProductBid extends ProductBid {
const historiesData = await this.getHistoriesData(); const historiesData = await this.getHistoriesData();
console.log({ historiesData });
// Nếu không có dữ liệu trả về thì dừng // Nếu không có dữ liệu trả về thì dừng
if (!result) { if (!result) {
console.log(`⚠️ [${this.id}] No valid data received, skipping update.`); console.log(`⚠️ [${this.id}] No valid data received, skipping update.`);
@ -371,6 +369,8 @@ export class AllbidsProductBid extends ProductBid {
} else { } else {
await this.handleCallActionLive(); await this.handleCallActionLive();
} }
await this.update();
} catch (error) { } catch (error) {
console.log(`🚨 [${this.id}] Error placing bid: ${error.message}`); console.log(`🚨 [${this.id}] Error placing bid: ${error.message}`);
} finally { } finally {