perf: 使用临期药品时, 如果存在时效识别失败的药品则取消本次吃药

This commit is contained in:
status102
2026-05-02 18:58:23 +08:00
parent a7548d7612
commit a4e2b12e06

View File

@@ -149,6 +149,13 @@ bool asst::MedicineCounterTaskPlugin::_run()
if (m_expire_days > 0) {
bool has_non_expiring = false;
for (const auto& [use, _, expire_days, __] : using_medicine->medicines) {
if (use > 0 && expire_days == -1) {
LogError << __FUNCTION__
<< "There are non-expiring medicines, and total count exceed max, need to reduce expire "
"medicines first";
has_non_expiring = true;
break;
}
if (use > 0 && expire_days != -1 && expire_days > m_expire_days) {
has_non_expiring = true;
break;