web/multinode: fix wrong undistributed payout amount

Resolves https://github.com/storj/storj/issues/5849

Change-Id: I074f6ca9f9ac1e8ffa62649188a6059d9bcd4c25
This commit is contained in:
Clement Sam 2023-05-04 02:17:17 +00:00
parent 162af1e836
commit 8a206f0aee
2 changed files with 17 additions and 1 deletions

View File

@ -4,6 +4,11 @@
import { Operators as OperatorsClient } from '@/api/operators';
import { Cursor, Page } from '@/private/pagination';
/**
* Divider to convert payout amounts to cents.
*/
const PRICE_DIVIDER = 10000;
/**
*Operator contains contains SNO payouts contact details and amount of undistributed payouts.
*/
@ -14,7 +19,9 @@ export class Operator {
public wallet: string,
public walletFeatures: string[] | null,
public undistributed: number,
) {}
) {
this.undistributed = this.convertToCents(this.undistributed);
}
/**
* indicates if wallet features are enabled.
@ -38,6 +45,10 @@ export class Operator {
// TODO: place this to config.
return `https://zkscan.io/explorer/accounts/${this.wallet}`;
}
private convertToCents(value: number): number {
return value / PRICE_DIVIDER;
}
}
/**

View File

@ -167,5 +167,10 @@ export class Expectation {
public currentMonthEstimation: number = 0,
public undistributed: number = 0,
) {
this.undistributed = this.convertToCents(this.undistributed);
}
private convertToCents(value: number): number {
return value / PRICE_DIVIDER;
}
}