fix(main): 修复计算吃饭数量返回值小于1的问题

- 修改返回值逻辑,当计算结果小于1时返回1
- 防止吃饭数量为0或负值导致的异常情况
- 优化代码可读性,提升鲁棒性
This commit is contained in:
mazengfei
2026-08-05 17:57:38 +08:00
parent 512e0b5b4f
commit 0241caa5fc
@@ -978,7 +978,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
}
val eatNum = (realWeight / specWeight).roundToInt()
log("getEatNum:eatNum=$eatNum,realWeight=$realWeight,specWeight=$specWeight,realWeight/$specWeight=${realWeight / specWeight}}")
return eatNum;
return if (eatNum < 1) 1 else eatNum;
}
/**