web/storagenode: payout calculation fix

Change-Id: Ibd030d0ef91a28e2cfa94da78c211c27959bb753
This commit is contained in:
NickolaiYurchenko 2020-04-21 18:09:54 +03:00
parent 3d56efc82d
commit 89c877f461
4 changed files with 10 additions and 14 deletions

View File

@ -72,7 +72,7 @@
<div class="column justify-start column-2"></div>
<div class="column justify-start column-3"></div>
<div class="column justify-start column-4">
<p class="estimation-table-container__total-area__text">{{ totalDiskSpace }}m</p>
<p class="estimation-table-container__total-area__text">{{ totalDiskSpace + 'h' }}</p>
</div>
<div class="column justify-start column-5">
<p class="estimation-table-container__total-area__text">{{ totalBandwidth }}</p>
@ -154,7 +154,7 @@ export default class EstimationArea extends Vue {
return this.grossTotal;
}
return this.$store.getters.totalPeriodPayout;
return this.heldInfo.paid;
}
/**
@ -163,7 +163,7 @@ export default class EstimationArea extends Vue {
public get grossTotal(): number {
return (this.currentBandwidthDownload * BANDWIDTH_DOWNLOAD_PRICE_PER_TB
+ this.currentBandwidthAuditAndRepair * BANDWIDTH_REPAIR_PRICE_PER_TB
+ this.currentDiskSpace * DISK_SPACE_PRICE_PER_TB) / TB;
+ this.currentDiskSpace * DISK_SPACE_PRICE_PER_TB / 730) / TB;
}
/**

View File

@ -117,8 +117,8 @@ export const node = {
suspended: selectedSatellite.suspended,
};
state.checks.uptime = parseFloat(parseFloat(`${satelliteInfo.uptime.score * 100}`).toFixed(1));
state.checks.audit = parseFloat(parseFloat(`${satelliteInfo.audit.score * 100}`).toFixed(1));
state.checks.uptime = satelliteInfo.uptime.totalCount ? 100 : satelliteInfo.uptime.successCount / satelliteInfo.uptime.totalCount * 100;
},
[SELECT_ALL_SATELLITES](state: any, satelliteInfo: Satellites): void {
state.selectedSatellite = {

View File

@ -93,12 +93,6 @@ export function makePayoutModule(api: PayoutApi) {
commit(PAYOUT_MUTATIONS.SET_RANGE, periodRange);
},
},
getters: {
totalPeriodPayout: function (state: PayoutState): number {
return state.heldInfo.compAtRest + state.heldInfo.compGet + state.heldInfo.compGetAudit
+ state.heldInfo.compGetRepair - state.heldInfo.held;
}
}
};
}

View File

@ -131,18 +131,20 @@ export class PayoutHttpApi implements PayoutApi {
let paid: number = 0;
data.forEach((paystub: any) => {
const surge = paystub.surgePercent === 0 ? 1 : paystub.surgePercent / 100;
usageAtRest += paystub.usageAtRest;
usageGet += paystub.usageGet;
usagePut += paystub.usagePut;
usageGetRepair += paystub.usageGetRepair;
usagePutRepair += paystub.usagePutRepair;
usageGetAudit += paystub.usageGetAudit;
compAtRest += paystub.compAtRest / this.PRICE_DIVIDER;
compGet += paystub.compGet / this.PRICE_DIVIDER;
compAtRest += paystub.compAtRest / this.PRICE_DIVIDER * surge;
compGet += paystub.compGet / this.PRICE_DIVIDER * surge;
compPut += paystub.compPut / this.PRICE_DIVIDER;
compGetRepair += paystub.compGetRepair / this.PRICE_DIVIDER;
compGetRepair += paystub.compGetRepair / this.PRICE_DIVIDER * surge;
compPutRepair += paystub.compPutRepair / this.PRICE_DIVIDER;
compGetAudit += paystub.compGetAudit / this.PRICE_DIVIDER;
compGetAudit += paystub.compGetAudit / this.PRICE_DIVIDER * surge;
held += paystub.held / this.PRICE_DIVIDER;
owed += paystub.owed / this.PRICE_DIVIDER;
disposed += paystub.disposed / this.PRICE_DIVIDER;