|
|
@ -283,6 +283,7 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
// 更新主观成绩,计算主观总分和客观总分
|
|
|
|
// 更新主观成绩,计算主观总分和客观总分
|
|
|
|
Map<String, Object> combinedScores = new HashMap<>();
|
|
|
|
Map<String, Object> combinedScores = new HashMap<>();
|
|
|
|
for (Map.Entry<String, Integer> entry : subjectiveScores.entrySet()) {
|
|
|
|
for (Map.Entry<String, Integer> entry : subjectiveScores.entrySet()) {
|
|
|
|
|
|
|
|
double score = 0;
|
|
|
|
String knowledgeBlock = entry.getKey();
|
|
|
|
String knowledgeBlock = entry.getKey();
|
|
|
|
int count = entry.getValue(); // 次数
|
|
|
|
int count = entry.getValue(); // 次数
|
|
|
|
// 确保 count 不小于0
|
|
|
|
// 确保 count 不小于0
|
|
|
@ -292,21 +293,29 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
double maxCount = 50.0; // 最大次数(可根据实际情况调整)
|
|
|
|
double maxCount = 50.0; // 最大次数(可根据实际情况调整)
|
|
|
|
|
|
|
|
|
|
|
|
// 将次数转换为 0-100 的分数
|
|
|
|
// 将次数转换为 0-100 的分数
|
|
|
|
double convertedScore = (count / maxCount) * 100;
|
|
|
|
double convertedScore;
|
|
|
|
|
|
|
|
if (count > maxCount) {
|
|
|
|
|
|
|
|
convertedScore = 100.0; // 如果次数超过最大次数,设置为满分
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
convertedScore = (count / maxCount) * 100;
|
|
|
|
|
|
|
|
}
|
|
|
|
subjectiveTotal += convertedScore;
|
|
|
|
subjectiveTotal += convertedScore;
|
|
|
|
|
|
|
|
|
|
|
|
// 获取对应知识块的客观成绩
|
|
|
|
// 获取对应知识块的客观成绩
|
|
|
|
double objectiveScore = knowledgeBlockScores.get(knowledgeBlock);
|
|
|
|
double objectiveScore = knowledgeBlockScores.get(knowledgeBlock);
|
|
|
|
objectiveTotal += objectiveScore;
|
|
|
|
objectiveTotal += objectiveScore;
|
|
|
|
|
|
|
|
score = convertedScore * 0.6 + objectiveScore * 0.4;
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
形成 次数/客观分数 的格式
|
|
|
|
形成 次数/客观分数 的格式
|
|
|
|
String combinedScore = count + "/" + objectiveScore;
|
|
|
|
String combinedScore = count + "/" + objectiveScore;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
int finalCount = count;
|
|
|
|
double finalCount = convertedScore;
|
|
|
|
|
|
|
|
double finalScore = score / knowledgeBlockCount;
|
|
|
|
combinedScores.put(knowledgeBlock, new HashMap<String, Object>() {{
|
|
|
|
combinedScores.put(knowledgeBlock, new HashMap<String, Object>() {{
|
|
|
|
put("count", finalCount);
|
|
|
|
put("count", finalCount);
|
|
|
|
put("objectiveScore", objectiveScore);
|
|
|
|
put("objectiveScore", objectiveScore);
|
|
|
|
|
|
|
|
put("compositeScore", finalScore);
|
|
|
|
|
|
|
|
|
|
|
|
}});
|
|
|
|
}});
|
|
|
|
//combinedScores.put(knowledgeBlock, objectiveScore);
|
|
|
|
//combinedScores.put(knowledgeBlock, objectiveScore);
|
|
|
|
|
|
|
|
|
|
|
|