termToHours converts a term string to the number of hours in that term. Returns 0 for unknown terms.
(term string)
| 115 | // termToHours converts a term string to the number of hours in that term. |
| 116 | // Returns 0 for unknown terms. |
| 117 | func termToHours(term string) int64 { |
| 118 | switch strings.TrimSpace(strings.ToLower(term)) { |
| 119 | case "1yr", "1y": |
| 120 | return 8760 |
| 121 | case "3yr", "3y": |
| 122 | return 26280 |
| 123 | default: |
| 124 | return 0 |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | // amortizedHourlyRate returns the effective hourly rate for a PriceEntry, |
| 129 | // spreading any upfront fee evenly over the term hours. |
no outgoing calls
no test coverage detected