satellite/compensation: make surge percent an int64 for strictcsv
Change-Id: I1783bf73ee68ca9beb8a03f5928873fab0bbe95d
This commit is contained in:
parent
644df8dcdc
commit
ffe7a3c211
@ -182,7 +182,7 @@ var (
|
||||
Database string `help:"satellite database connection string" releaseDefault:"postgres://" devDefault:"postgres://"`
|
||||
Output string `help:"destination of report output" default:""`
|
||||
Compensation compensation.Config
|
||||
SurgePercent int `help:"surge percent for payments" default:"0"`
|
||||
SurgePercent int64 `help:"surge percent for payments" default:"0"`
|
||||
}
|
||||
recordPeriodCfg struct {
|
||||
Database string `help:"satellite database connection string" releaseDefault:"postgres://" devDefault:"postgres://"`
|
||||
|
@ -34,7 +34,7 @@ type Invoice struct {
|
||||
CompGetRepair currency.MicroUnit `csv:"comp-get-repair"` // Compensation for usage-get-repair
|
||||
CompPutRepair currency.MicroUnit `csv:"comp-put-repair"` // Compensation for usage-put-repair
|
||||
CompGetAudit currency.MicroUnit `csv:"comp-get-audit"` // Compensation for usage-get-audit
|
||||
SurgePercent int `csv:"surge-percent"` // Surge percent used to calculate compensation, or 0 if no surge
|
||||
SurgePercent int64 `csv:"surge-percent"` // Surge percent used to calculate compensation, or 0 if no surge
|
||||
Owed currency.MicroUnit `csv:"owed"` // Amount we intend to pay to the node (sum(comp-*) - held + disposed)
|
||||
Held currency.MicroUnit `csv:"held"` // Amount held from sum(comp-*) for this period
|
||||
Disposed currency.MicroUnit `csv:"disposed"` // Amount of owed that is due to graceful-exit or held period ending
|
||||
|
@ -60,7 +60,7 @@ type Statement struct {
|
||||
GetRepair currency.MicroUnit
|
||||
PutRepair currency.MicroUnit
|
||||
GetAudit currency.MicroUnit
|
||||
SurgePercent int
|
||||
SurgePercent int64
|
||||
Owed currency.MicroUnit
|
||||
Held currency.MicroUnit
|
||||
Disposed currency.MicroUnit
|
||||
@ -93,7 +93,7 @@ type PeriodInfo struct {
|
||||
|
||||
// SurgePercent is the percent to adjust final amounts owed. For example,
|
||||
// to pay 150%, set to 150. Zero means no surge.
|
||||
SurgePercent int
|
||||
SurgePercent int64
|
||||
}
|
||||
|
||||
// GenerateStatements generates all of the Statements for the given PeriodInfo.
|
||||
@ -109,7 +109,7 @@ func GenerateStatements(info PeriodInfo) ([]Statement, error) {
|
||||
withheldPercents = DefaultWithheldPercents
|
||||
}
|
||||
|
||||
surgePercent := decimal.NewFromInt(int64(info.SurgePercent))
|
||||
surgePercent := decimal.NewFromInt(info.SurgePercent)
|
||||
disposePercent := decimal.NewFromInt(int64(info.DisposePercent))
|
||||
|
||||
// Intermediate calculations (especially at-rest related) can overflow an
|
||||
|
@ -44,7 +44,7 @@ func TestGenerateStatements(t *testing.T) {
|
||||
nodeID := testrand.NodeID()
|
||||
for _, tt := range []struct {
|
||||
name string
|
||||
surgePercent int
|
||||
surgePercent int64
|
||||
node compensation.NodeInfo
|
||||
statement compensation.Statement
|
||||
}{
|
||||
|
Loading…
Reference in New Issue
Block a user