fix(trainingCourseRecord): 确保学习时长单调不下降,避免前端误传导致统计异常

This commit is contained in:
2026-05-27 16:18:44 +08:00
parent e8f15ae740
commit be53d4b47b

View File

@@ -186,6 +186,12 @@ public class HotTrainingCourseRecordServiceImpl implements IHotTrainingCourseRec
update.setProgressRate(before.getProgressRate()); update.setProgressRate(before.getProgressRate());
} }
} }
if (before != null && before.getLearnDurationMin() != null && update.getLearnDurationMin() != null) {
// 确保学习时长单调不下降避免前端误传0导致统计为0
if (update.getLearnDurationMin() < before.getLearnDurationMin()) {
update.setLearnDurationMin(before.getLearnDurationMin());
}
}
} }
initHourPackageUsageFieldsForUpdate(update, before); initHourPackageUsageFieldsForUpdate(update, before);
validEntityBeforeSave(update); validEntityBeforeSave(update);