mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: position relative neighbor caching
This commit is contained in:
1 parent
aea01072fb
commit
c799534009
1 file changed
+8
-2
@@ -277,12 +277,18 @@ export default function Page() {
|
|||||||
if (!isMissing) return [];
|
if (!isMissing) return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const seedingPlayerPosition = parseInt(
|
||||||
|
Object.entries(players[region][season]).find(
|
||||||
|
([, player]) => id === player.id,
|
||||||
|
)![0],
|
||||||
|
);
|
||||||
const { neighbors } = await getRatingsNeighbors(region, id, size, true);
|
const { neighbors } = await getRatingsNeighbors(region, id, size, true);
|
||||||
|
|
||||||
usePlayersCache.setState(
|
usePlayersCache.setState(
|
||||||
produce((draft: PlayersCache) => {
|
produce((draft: PlayersCache) => {
|
||||||
neighbors.forEach((neighbor) => {
|
neighbors.forEach((neighbor, neighborIndex) => {
|
||||||
const position = neighbor.number - 1;
|
// const position = neighbor.number - 1;
|
||||||
|
const position = neighborIndex - radius + seedingPlayerPosition;
|
||||||
|
|
||||||
if (!(position in draft[region][season])) {
|
if (!(position in draft[region][season])) {
|
||||||
draft[region][season][position] = {
|
draft[region][season][position] = {
|
||||||
|
|||||||
Reference in new issue
Block a user