If this item's alert level is at least as high as the threshold, return the string that should be used as its "level of concern" and `true`; otherwise, return `"", false`.
(threshold Threshold)
| 174 | // return the string that should be used as its "level of concern" and |
| 175 | // `true`; otherwise, return `"", false`. |
| 176 | func (i *item) levelOfConcern(threshold Threshold) (string, bool) { |
| 177 | value, overflow := i.value.ToUint64() |
| 178 | if overflow { |
| 179 | return "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", true |
| 180 | } |
| 181 | alert := Threshold(float64(value) / i.scale) |
| 182 | if alert < threshold { |
| 183 | return "", false |
| 184 | } |
| 185 | if alert > 30 { |
| 186 | return "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", true |
| 187 | } |
| 188 | return stars[:int(alert)], true |
| 189 | } |
| 190 | |
| 191 | func (i *item) CollectItems(items map[string]*item) { |
| 192 | items[i.symbol] = i |