From 422ccfe82e31dae34f80b18d7d5cc7e20b72d45b Mon Sep 17 00:00:00 2001 From: jeremy-babylonchain Date: Wed, 18 Sep 2024 18:33:38 +0700 Subject: [PATCH] floor to three decimals and update n.a. ui --- src/app/components/Points/DelegationPoints.tsx | 2 +- src/app/components/Points/StakerPoints.tsx | 2 +- src/app/context/api/DelegationsPointsProvider.tsx | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/app/components/Points/DelegationPoints.tsx b/src/app/components/Points/DelegationPoints.tsx index 387cef12..25b32f0c 100644 --- a/src/app/components/Points/DelegationPoints.tsx +++ b/src/app/components/Points/DelegationPoints.tsx @@ -25,7 +25,7 @@ export const DelegationPoints: React.FC = ({

Points: - {points !== undefined ? points : 0} + {points !== undefined ? points : "n.a."}

); diff --git a/src/app/components/Points/StakerPoints.tsx b/src/app/components/Points/StakerPoints.tsx index d41a3cf9..1374e340 100644 --- a/src/app/components/Points/StakerPoints.tsx +++ b/src/app/components/Points/StakerPoints.tsx @@ -32,7 +32,7 @@ export const StakerPoints: React.FC = ({ return (

- {points !== undefined ? points : 0} + {points !== undefined ? points : "n.a."}

); diff --git a/src/app/context/api/DelegationsPointsProvider.tsx b/src/app/context/api/DelegationsPointsProvider.tsx index 816f3493..57849e79 100644 --- a/src/app/context/api/DelegationsPointsProvider.tsx +++ b/src/app/context/api/DelegationsPointsProvider.tsx @@ -89,10 +89,8 @@ export const DelegationsPointsProvider: React.FC< const newDelegationPoints = new Map(); data.forEach((point) => { if (point) { - newDelegationPoints.set( - point.staking_tx_hash_hex, - point.staker.points, - ); + const flooredPoints = Math.floor(point.staker.points * 1000) / 1000; // Floors the points to 3 decimal places + newDelegationPoints.set(point.staking_tx_hash_hex, flooredPoints); } }); setDelegationPoints(newDelegationPoints);