findLargestDecimal finds the key with the largest decimal value
(amounts map[string]decimal.Decimal)
| 257 | |
| 258 | // findLargestDecimal finds the key with the largest decimal value |
| 259 | func findLargestDecimal(amounts map[string]decimal.Decimal) (string, decimal.Decimal) { |
| 260 | var largestKey string |
| 261 | var largestAmount decimal.Decimal |
| 262 | for id, amount := range amounts { |
| 263 | if amount.Cmp(largestAmount) > 0 { |
| 264 | largestAmount = amount |
| 265 | largestKey = id |
| 266 | } |
| 267 | } |
| 268 | return largestKey, largestAmount |
| 269 | } |
| 270 | |
| 271 | // combineDistributions merges fixed and percentage amounts into the result |
| 272 | func combineDistributions(state *distributionState) { |
no outgoing calls