[TASK] fix max value in availablity funktion
This commit is contained in:
parent
157431d425
commit
0cfa486c95
|
@ -21,6 +21,9 @@ func tempPercent(value, max int) int {
|
|||
|
||||
// Function to calculate a partial radius, depending on a percentage value
|
||||
func tempProcessRadius(value, max, radius int) float64 {
|
||||
if value >= max {
|
||||
return 0
|
||||
}
|
||||
return (1 - float64(value)/float64(max)) * float64(radius) * 2 * 3.14
|
||||
}
|
||||
|
||||
|
|
|
@ -16,4 +16,7 @@ func TestTempFuncs(t *testing.T) {
|
|||
// TODO is there a other way to calc this?
|
||||
resultFloat := tempProcessRadius(3, 9, 0)
|
||||
assert.Equal(float64(0), resultFloat)
|
||||
|
||||
resultFloat = tempProcessRadius(12, 9, 10)
|
||||
assert.Equal(float64(0), resultFloat)
|
||||
}
|
||||
|
|
Reference in New Issue