storagenode/pieces: hours in a month should be 720
Per https://documentation.tardigrade.io/pricing/billing-and-payment: "The calculation of per object fees is based on a standard 720-hour month." On most years, the average value is 730 (365*24/12), except leap years. However, we want to have ours be 720 (30*24) so its lines up with days. Change-Id: Ifb9691878f1a7ea81ed36c92b37985493295fe31
This commit is contained in:
parent
e9dd5b2845
commit
a3c902ab84
@ -132,7 +132,7 @@ func TestStorageNodeApi(t *testing.T) {
|
|||||||
expectedAuditRepairSatellite2 := 4 * float64(randAmount2*repairPrice) / math.Pow10(12)
|
expectedAuditRepairSatellite2 := 4 * float64(randAmount2*repairPrice) / math.Pow10(12)
|
||||||
expectedUsageSatellite1 := 2 * float64(randAmount1*egressPrice) / math.Pow10(12)
|
expectedUsageSatellite1 := 2 * float64(randAmount1*egressPrice) / math.Pow10(12)
|
||||||
expectedUsageSatellite2 := 2 * float64(randAmount2*egressPrice) / math.Pow10(12)
|
expectedUsageSatellite2 := 2 * float64(randAmount2*egressPrice) / math.Pow10(12)
|
||||||
expectedDisk := int64(float64(30000000000000*diskPrice/730)/math.Pow10(12)) * int64(time.Now().UTC().Day())
|
expectedDisk := int64(float64(30000000000000*diskPrice/720)/math.Pow10(12)) * int64(time.Now().UTC().Day())
|
||||||
|
|
||||||
day := int64(time.Now().Day())
|
day := int64(time.Now().Day())
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ func (s *Service) estimatedPayoutCurrentMonth(ctx context.Context, satelliteID s
|
|||||||
}
|
}
|
||||||
|
|
||||||
for j := 0; j < len(storageDaily); j++ {
|
for j := 0; j < len(storageDaily); j++ {
|
||||||
diskSpace := (storageDaily[j].AtRestTotal * float64(priceModel.DiskSpace) / 730) / math.Pow10(12)
|
diskSpace := (storageDaily[j].AtRestTotal * float64(priceModel.DiskSpace) / 720) / math.Pow10(12)
|
||||||
totalSum += int64(diskSpace)
|
totalSum += int64(diskSpace)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,7 +510,7 @@ func (s *Service) estimatedPayoutPreviousMonth(ctx context.Context, satelliteID
|
|||||||
|
|
||||||
for j := 0; j < len(storageDaily); j++ {
|
for j := 0; j < len(storageDaily); j++ {
|
||||||
payoutData.DiskSpace += storageDaily[j].AtRestTotal
|
payoutData.DiskSpace += storageDaily[j].AtRestTotal
|
||||||
payoutData.DiskSpacePayout += int64(storageDaily[j].AtRestTotal / 730 / math.Pow10(12) * float64(priceModel.DiskSpace*heldRate/100))
|
payoutData.DiskSpacePayout += int64(storageDaily[j].AtRestTotal / 720 / math.Pow10(12) * float64(priceModel.DiskSpace*heldRate/100))
|
||||||
}
|
}
|
||||||
|
|
||||||
return payoutData, nil
|
return payoutData, nil
|
||||||
|
@ -222,7 +222,7 @@ export default class EstimationArea extends Vue {
|
|||||||
public get grossTotal(): number {
|
public get grossTotal(): number {
|
||||||
return (this.currentBandwidthDownload * BANDWIDTH_DOWNLOAD_PRICE_PER_TB
|
return (this.currentBandwidthDownload * BANDWIDTH_DOWNLOAD_PRICE_PER_TB
|
||||||
+ this.currentBandwidthAuditAndRepair * BANDWIDTH_REPAIR_PRICE_PER_TB
|
+ this.currentBandwidthAuditAndRepair * BANDWIDTH_REPAIR_PRICE_PER_TB
|
||||||
+ this.currentDiskSpace * DISK_SPACE_PRICE_PER_TB / 730) / TB;
|
+ this.currentDiskSpace * DISK_SPACE_PRICE_PER_TB / 720) / TB;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -289,7 +289,7 @@ export default class EstimationArea extends Vue {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
const approxHourInMonth = 730;
|
const approxHourInMonth = 720;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
new EstimationTableRow(
|
new EstimationTableRow(
|
||||||
|
@ -60,7 +60,7 @@ export function makePayoutModule(api: PayoutApi) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
[PAYOUT_ACTIONS.GET_HELD_INFO]: async function ({commit, state, rootState}: any, satelliteId: string = ''): Promise<void> {
|
[PAYOUT_ACTIONS.GET_HELD_INFO]: async function ({ commit, state, rootState }: any, satelliteId: string = ''): Promise<void> {
|
||||||
const heldInfo = state.periodRange.start ? await api.getHeldInfoByPeriod(new PaymentInfoParameters(
|
const heldInfo = state.periodRange.start ? await api.getHeldInfoByPeriod(new PaymentInfoParameters(
|
||||||
state.periodRange.start,
|
state.periodRange.start,
|
||||||
state.periodRange.end,
|
state.periodRange.end,
|
||||||
@ -74,7 +74,7 @@ export function makePayoutModule(api: PayoutApi) {
|
|||||||
commit(PAYOUT_MUTATIONS.SET_HELD_PERCENT, getHeldPercentage(rootState.node.selectedSatellite.joinDate));
|
commit(PAYOUT_MUTATIONS.SET_HELD_PERCENT, getHeldPercentage(rootState.node.selectedSatellite.joinDate));
|
||||||
commit(PAYOUT_MUTATIONS.SET_HELD_INFO, heldInfo);
|
commit(PAYOUT_MUTATIONS.SET_HELD_INFO, heldInfo);
|
||||||
},
|
},
|
||||||
[PAYOUT_ACTIONS.GET_TOTAL]: async function ({commit, rootState}: any, satelliteId: string = ''): Promise<void> {
|
[PAYOUT_ACTIONS.GET_TOTAL]: async function ({ commit, rootState }: any, satelliteId: string = ''): Promise<void> {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const totalPayoutInfo = await api.getTotal(new PaymentInfoParameters(
|
const totalPayoutInfo = await api.getTotal(new PaymentInfoParameters(
|
||||||
new PayoutPeriod(rootState.node.selectedSatellite.joinDate.getUTCFullYear(), rootState.node.selectedSatellite.joinDate.getUTCMonth()),
|
new PayoutPeriod(rootState.node.selectedSatellite.joinDate.getUTCFullYear(), rootState.node.selectedSatellite.joinDate.getUTCMonth()),
|
||||||
@ -90,7 +90,7 @@ export function makePayoutModule(api: PayoutApi) {
|
|||||||
.map(data => data.egress.audit + data.egress.repair)
|
.map(data => data.egress.audit + data.egress.repair)
|
||||||
.reduce((previous, current) => previous + current, 0);
|
.reduce((previous, current) => previous + current, 0);
|
||||||
|
|
||||||
const approxHourInMonth = 730;
|
const approxHourInMonth = 720;
|
||||||
const currentDiskSpace = (rootState.node.storageChartData || [])
|
const currentDiskSpace = (rootState.node.storageChartData || [])
|
||||||
.map(data => data.atRestTotal)
|
.map(data => data.atRestTotal)
|
||||||
.reduce((previous, current) => previous + current, 0) / approxHourInMonth;
|
.reduce((previous, current) => previous + current, 0) / approxHourInMonth;
|
||||||
@ -102,10 +102,10 @@ export function makePayoutModule(api: PayoutApi) {
|
|||||||
commit(PAYOUT_MUTATIONS.SET_HELD_PERCENT, getHeldPercentage(rootState.node.selectedSatellite.joinDate));
|
commit(PAYOUT_MUTATIONS.SET_HELD_PERCENT, getHeldPercentage(rootState.node.selectedSatellite.joinDate));
|
||||||
commit(PAYOUT_MUTATIONS.SET_TOTAL, new TotalPayoutInfo(totalPayoutInfo.totalHeldAmount, totalPayoutInfo.totalEarnings, thisMonthEarnings));
|
commit(PAYOUT_MUTATIONS.SET_TOTAL, new TotalPayoutInfo(totalPayoutInfo.totalHeldAmount, totalPayoutInfo.totalEarnings, thisMonthEarnings));
|
||||||
},
|
},
|
||||||
[PAYOUT_ACTIONS.SET_PERIODS_RANGE]: function ({commit}: any, periodRange: PayoutInfoRange): void {
|
[PAYOUT_ACTIONS.SET_PERIODS_RANGE]: function ({ commit }: any, periodRange: PayoutInfoRange): void {
|
||||||
commit(PAYOUT_MUTATIONS.SET_RANGE, periodRange);
|
commit(PAYOUT_MUTATIONS.SET_RANGE, periodRange);
|
||||||
},
|
},
|
||||||
[PAYOUT_ACTIONS.GET_HELD_HISTORY]: async function ({commit}: any): Promise<void> {
|
[PAYOUT_ACTIONS.GET_HELD_HISTORY]: async function ({ commit }: any): Promise<void> {
|
||||||
const heldHistory = await api.getHeldHistory();
|
const heldHistory = await api.getHeldHistory();
|
||||||
|
|
||||||
commit(PAYOUT_MUTATIONS.SET_HELD_HISTORY, heldHistory);
|
commit(PAYOUT_MUTATIONS.SET_HELD_HISTORY, heldHistory);
|
||||||
|
Loading…
Reference in New Issue
Block a user