processLeftDistribution handles the "left" distribution type
(distributions []Distribution, state *distributionState)
| 282 | |
| 283 | // processLeftDistribution handles the "left" distribution type |
| 284 | func processLeftDistribution(distributions []Distribution, state *distributionState) error { |
| 285 | for _, dist := range distributions { |
| 286 | if !dist.isLeftDistribution() { |
| 287 | continue |
| 288 | } |
| 289 | |
| 290 | if _, exists := state.result[dist.Identifier]; exists { |
| 291 | return errors.New("multiple identifiers with 'left' distribution") |
| 292 | } |
| 293 | |
| 294 | state.result[dist.Identifier] = state.amountLeftDec.BigInt() |
| 295 | break |
| 296 | } |
| 297 | return nil |
| 298 | } |
| 299 | |
| 300 | // balanceDistributions ensures the sum of all distributions equals the total amount |
| 301 | func balanceDistributions(state *distributionState) { |
no test coverage detected