Skip to content

Commit

Permalink
fix index issues
Browse files Browse the repository at this point in the history
  • Loading branch information
radumojic committed Feb 20, 2024
1 parent 417553d commit 3802549
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/helpers/getValue/getExpandRowDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ export const getExpandRowDetails = (nodes: NodeType[] = []) => {
remainingDangerZoneValidators,
remainingNotQualifiedValidators;

const qualifiedNotInDangerZoneValidators = nodes.filter(
(node) => node.auctionQualified && !node.isInDangerZone
);
const dangerZoneValidators = nodes.filter((nodes) => nodes.isInDangerZone);
const notQualifiedValidators = nodes.filter((node) => !node.auctionQualified);
const qualifiedNotInDangerZoneValidators =
nodes.filter((node) => node.auctionQualified && !node.isInDangerZone) ?? [];
const dangerZoneValidators =
nodes.filter((nodes) => nodes.isInDangerZone) ?? [];
const notQualifiedValidators =
nodes.filter((node) => !node.auctionQualified) ?? [];

if (
hasMinElements &&
Expand All @@ -36,10 +37,10 @@ export const getExpandRowDetails = (nodes: NodeType[] = []) => {

qualifiedExpandPosition =
qualifiedNotInDangerZoneValidators[AUCTION_LIST_EXPAND_ROW_POSITION]
.auctionPosition;
?.auctionPosition;

qualifiedExpandClosePosition =
qualifiedNotInDangerZoneValidators[closeIndex].auctionPosition;
qualifiedNotInDangerZoneValidators[closeIndex]?.auctionPosition;

remainingQualifiedValidators =
qualifiedNotInDangerZoneValidators.length -
Expand All @@ -49,10 +50,10 @@ export const getExpandRowDetails = (nodes: NodeType[] = []) => {
const closeIndex = dangerZoneValidators.length - 1 - closedRowPosition;

dangerZoneExpandPosition =
dangerZoneValidators[AUCTION_LIST_EXPAND_ROW_POSITION].auctionPosition;
dangerZoneValidators[AUCTION_LIST_EXPAND_ROW_POSITION]?.auctionPosition;

dangerZoneExpandClosePosition =
dangerZoneValidators[closeIndex].auctionPosition;
dangerZoneValidators[closeIndex]?.auctionPosition;

remainingDangerZoneValidators =
dangerZoneValidators.length - AUCTION_LIST_MIN_DISPLAY_ROW_COUNT;
Expand All @@ -62,10 +63,10 @@ export const getExpandRowDetails = (nodes: NodeType[] = []) => {

notQualifiedExpandPosition =
qualifiedNotInDangerZoneValidators[AUCTION_LIST_EXPAND_ROW_POSITION]
.auctionPosition;
?.auctionPosition;

notQualifiedExpandClosePosition =
notQualifiedValidators[closeIndex].auctionPosition;
notQualifiedValidators[closeIndex]?.auctionPosition;

remainingNotQualifiedValidators =
notQualifiedValidators.length - AUCTION_LIST_MIN_DISPLAY_ROW_COUNT;
Expand Down

0 comments on commit 3802549

Please sign in to comment.