Skip to content

Commit

Permalink
fix(multiplayer): prevent shared room price instability
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyckahn committed Dec 18, 2024
1 parent 00c2685 commit 11f5e0f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions api/post-day-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,16 @@ export default allowCors(async (req, res) => {
} = req

const roomKey = getRoomName(req)
const { valueAdjustments } = await getRoomData(roomKey, get, set)
const { valueAdjustments, ...roomData } = await getRoomData(roomKey, get, set)
const updatedValueAdjustments = applyPositionsToMarket(
valueAdjustments,
positions
)

set(roomKey, JSON.stringify(updatedValueAdjustments))
set(
roomKey,
JSON.stringify({ ...roomData, valueAdjustments: updatedValueAdjustments })
)

res.status(200).json({ valueAdjustments: updatedValueAdjustments })
})

0 comments on commit 11f5e0f

Please sign in to comment.