From 42ce72f5209e8af981410625f339c530fa6afc75 Mon Sep 17 00:00:00 2001 From: "hhb@hotmail.com" Date: Fri, 14 Mar 2025 10:12:49 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=A4=84=E7=90=86=E8=B4=9F=E6=95=B0?= =?UTF-8?q?=E5=BE=97=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/service/impl/LaborEducationServiceImpl.java | 4 ++++ .../admin/service/impl/MoralEducationServiceImpl.java | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/main/java/cn/teammodel/controller/admin/service/impl/LaborEducationServiceImpl.java b/src/main/java/cn/teammodel/controller/admin/service/impl/LaborEducationServiceImpl.java index 3aa13e6..a9204bf 100644 --- a/src/main/java/cn/teammodel/controller/admin/service/impl/LaborEducationServiceImpl.java +++ b/src/main/java/cn/teammodel/controller/admin/service/impl/LaborEducationServiceImpl.java @@ -392,9 +392,13 @@ public class LaborEducationServiceImpl implements LaborEducationService { studentScores.putIfAbsent(studentKey, new HashMap<>()); Map studentScoreMap = studentScores.get(studentKey); + // 计分 // 计分 int score = isPraise ? 1 : -1; int currentScore = studentScoreMap.getOrDefault(knowledgeBlock, 0) + score; + if (currentScore < 0) { + currentScore = 0; // 或者你可以设置为其他最小允许的分数 + } studentScoreMap.put(knowledgeBlock, currentScore); // 存储每个学生的评价记录 diff --git a/src/main/java/cn/teammodel/controller/admin/service/impl/MoralEducationServiceImpl.java b/src/main/java/cn/teammodel/controller/admin/service/impl/MoralEducationServiceImpl.java index 47309f3..9c766b0 100644 --- a/src/main/java/cn/teammodel/controller/admin/service/impl/MoralEducationServiceImpl.java +++ b/src/main/java/cn/teammodel/controller/admin/service/impl/MoralEducationServiceImpl.java @@ -395,6 +395,9 @@ public class MoralEducationServiceImpl implements MoralEducationService { // 计分 int score = isPraise ? 1 : -1; int currentScore = studentScoreMap.getOrDefault(knowledgeBlock, 0) + score; + if (currentScore < 0) { + currentScore = 0; // 或者你可以设置为其他最小允许的分数 + } studentScoreMap.put(knowledgeBlock, currentScore); // 存储每个学生的评价记录