Skip to content

Commit

Permalink
OCT-1552 Metrics pie chart show negative values (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
aziolek authored Apr 12, 2024
1 parent d9da5c7 commit 5c376f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/app/infrastructure/routes/epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def get(self):
),
"ppf": fields.String(
required=False,
description="PPF for the given epoch. It's calculated from staking proceeds directly.",
description="PPF for the given epoch. It's calculated from staking proceeds directly. Includes individualRewards.",
),
"communityFund": fields.String(
required=False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@ const MetricsEpochGridFundsUsage: FC<MetricsEpochGridFundsUsageProps> = ({
ethBelowThreshold
: BigInt(0);

/**
* epochInfo.ppf includes epochInfo.individualRewards.
* Half of PPF goes to the users to manage.
* Half of PPR goes to "PPF" section.
*/
const claimedByUsers = epochInfo
? epochInfo.individualRewards - totalUserDonationsWithPatronRewards - unusedRewards
? epochInfo.ppf / 2n - totalUserDonationsWithPatronRewards - unusedRewards
: BigInt(0);

const total =
Expand Down Expand Up @@ -79,7 +84,7 @@ const MetricsEpochGridFundsUsage: FC<MetricsEpochGridFundsUsageProps> = ({
},
{
label: t('ppf'),
value: getNumberValue(ppf),
value: getNumberValue(ppf / 2n),
valueLabel: getFormattedEthValue(ppf, true, false, false, 2).fullString,
},
];
Expand Down

0 comments on commit 5c376f0

Please sign in to comment.