Improve auction realtime bid responsiveness
This commit is contained in:
1 parent
c6f5a7077f
commit
b367328df0
16 files changed
+1364
-203
No files matched your search
@@ -135,6 +135,7 @@ export interface AuctionStateView {
|
||||
}[];
|
||||
currentBid: number;
|
||||
currentBidder: { teamIndex: number } | null;
|
||||
remainingMs: number;
|
||||
timer: number;
|
||||
maxTimer: number;
|
||||
bidExtensionSeconds: number;
|
||||
@@ -232,10 +233,11 @@ function mapAuctionPlayerToView(
|
||||
player: ApiAuctionPlayerSnapshot,
|
||||
): AuctionPlayerView {
|
||||
const { mainPosition, subPosition } = resolveMainAndSubPosition(
|
||||
player.preferredPositions,
|
||||
player.preferredPositions ?? [],
|
||||
);
|
||||
const summary = player.recentStatsSummary;
|
||||
const primary = pickPrimary(summary, mainPosition);
|
||||
const masteries = player.masteries ?? [];
|
||||
|
||||
return {
|
||||
id: player.userId,
|
||||
@@ -246,9 +248,9 @@ function mapAuctionPlayerToView(
|
||||
tierHistory: player.tierHistory ?? [],
|
||||
mainPosition,
|
||||
subPosition,
|
||||
profileIconId: player.profileIconId,
|
||||
profileIconId: player.profileIconId ?? 0,
|
||||
passCount: player.passCount ?? 0,
|
||||
masteries: player.masteries.slice(0, 5).map((mastery) => ({
|
||||
masteries: masteries.slice(0, 5).map((mastery) => ({
|
||||
championId: mastery.championId,
|
||||
level: mastery.championLevel,
|
||||
points: mastery.championPoints,
|
||||
@@ -530,14 +532,10 @@ export function mapApiAuctionToAuctionState(
|
||||
) ?? null);
|
||||
const currentPlayerIndex =
|
||||
auction.phase === "complete" ? totalPlayers : currentAuctionPlayerOrderIndex;
|
||||
const timer = currentBidRoundDeadlineTimestampMS
|
||||
? Math.max(
|
||||
0,
|
||||
Math.ceil(
|
||||
(currentBidRoundDeadlineTimestampMS - now.getTime()) / 1000,
|
||||
),
|
||||
)
|
||||
const remainingMs = currentBidRoundDeadlineTimestampMS
|
||||
? Math.max(0, currentBidRoundDeadlineTimestampMS - now.getTime())
|
||||
: 0;
|
||||
const timer = Math.floor(remainingMs / 1000);
|
||||
|
||||
return {
|
||||
matchId: auction.matchId,
|
||||
@@ -560,6 +558,7 @@ export function mapApiAuctionToAuctionState(
|
||||
teamIndex: currentBidderTeamIndex,
|
||||
}
|
||||
: null,
|
||||
remainingMs,
|
||||
timer,
|
||||
maxTimer: maximumBidRoundDurationSeconds,
|
||||
bidExtensionSeconds: bidRoundExtensionSeconds,
|
||||
|
||||
Reference in new issue
Block a user