fix the external scaler error when minAvailable is 0 (#227)

Signed-off-by: ChrisLiu <chrisliu1995@163.com>
This commit is contained in:
ChrisLiu 2025-05-19 17:37:40 +08:00 committed by GitHub
parent f2044b8f1a
commit 4e6ae2e2d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -197,7 +197,7 @@ func handleMinNum(totalNum, noneNum int, minNumStr string) (int, error) {
delta = math.Round(delta*100) / 100
minNum := int(math.Ceil(delta)) + noneNum
return minNum, nil
case n >= 1:
case n >= 1 || n == 0:
n = math.Ceil(n)
return int(n), nil
}

View File

@ -102,7 +102,7 @@ func TestHandleMinNum(t *testing.T) {
noneNum: 2,
minNumStr: "0",
wantMin: 0,
wantErr: true,
wantErr: false,
},
{
name: "invalid n - negative",