1、课程实操-查看详情-成绩页面-分数汇总

beetlsql3-dev
wgf 2 years ago
parent 7cefd581f6
commit e851872bba

@ -133,6 +133,9 @@ public class TeacherOpenCourseMergeResourcesQuestion extends BaseEntity {
//来源Id
private Long sourceFromId;
//学生分数
private BigDecimal studentScore;
public TeacherOpenCourseMergeResourcesQuestion(){
}
@ -374,4 +377,12 @@ public class TeacherOpenCourseMergeResourcesQuestion extends BaseEntity {
public void setSourceFromId(Long sourceFromId) {
this.sourceFromId = sourceFromId;
}
public BigDecimal getStudentScore() {
return studentScore;
}
public void setStudentScore(BigDecimal studentScore) {
this.studentScore = studentScore;
}
}

@ -414,10 +414,12 @@ public class StudentHandsOnTaskTheoryService extends CoreBaseService<StudentHand
.filter(v -> v.getStudentId().equals(student.getStudentId())).filter(v -> v.getHandsOnTaskId().equals(taskId)).findFirst().orElse(null);
if (taskTheory == null) {
resourcesQuestion.set("myOptions", "");
resourcesQuestion.set("studentScore", 0D);
// resourcesQuestion.set("studentScore", 0D);
resourcesQuestion.setStudentScore(BigDecimal.ZERO);
}else {
resourcesQuestion.set("myOptions", taskTheory.getMyOptions());
resourcesQuestion.set("studentScore", taskTheory.getTheoryScore());
// resourcesQuestion.set("studentScore", taskTheory.getTheoryScore());
resourcesQuestion.setStudentScore(taskTheory.getTheoryScore());
}
}

@ -1,5 +1,6 @@
package com.ibeetl.jlw.web;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.jlw.Interceptor.GetFile;
import cn.jlw.Interceptor.RFile;
@ -41,6 +42,9 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
import java.util.stream.Collectors;
@ -445,14 +449,14 @@ public class StudentHandsOnTaskTheoryController {
for (StudentHandsOnTaskTheory studentHandsOnTaskTheory : list) {
Integer questionType = studentHandsOnTaskTheory.getQuestionType();
studentHandsOnTaskTheory.set("questionTypeText",map.get(questionType));
studentHandsOnTaskTheory.set("questionTypeText", map.get(questionType));
String stem = studentHandsOnTaskTheory.getStem();
if (StringUtils.isNotBlank(stem)){
stem = stem.replace("<p>","")
.replace("</p>","")
.replace("<br>","")
.replace("<br/>","")
.replace("[---]","____");
if (StringUtils.isNotBlank(stem)) {
stem = stem.replace("<p>", "")
.replace("</p>", "")
.replace("<br>", "")
.replace("<br/>", "")
.replace("[---]", "____");
studentHandsOnTaskTheory.setStem(stem);
}
@ -501,7 +505,6 @@ public class StudentHandsOnTaskTheoryController {
}
/**
*
*
@ -538,6 +541,38 @@ public class StudentHandsOnTaskTheoryController {
return studentHandsOnTaskTheoryService.getHandsOnTaskkTheoryByTaskId(taskId, coreUser, 2);
}
/**
* -
*
* @param taskId id
* @param coreUser
* @return myOptions
*/
@GetMapping(API + "/getHandsOnTaskkTheoryDetailByTaskIdTotal")
public JsonResult getHandsOnTaskkTheoryDetailByTaskIdTotal(Long taskId, @SCoreUser CoreUser coreUser) {
JsonResult<List<TeacherOpenCourseMergeResourcesQuestion>> handsOnTaskkTheoryByTaskId = studentHandsOnTaskTheoryService.getHandsOnTaskkTheoryByTaskId(taskId, coreUser, 2);
List<TeacherOpenCourseMergeResourcesQuestion> resourcesQuestions = handsOnTaskkTheoryByTaskId.getData();
BigDecimal totalScore = BigDecimal.ZERO;
int totalRight = 0;
for (TeacherOpenCourseMergeResourcesQuestion resourcesQuestion : resourcesQuestions) {
if (ObjectUtil.isNotEmpty(resourcesQuestion.getStudentScore()) && !ObjectUtil.equals(resourcesQuestion.getStudentScore(), BigDecimal.ZERO)) {
totalScore = totalScore.add(resourcesQuestion.getStudentScore());
totalRight += 1;
}
}
int size = resourcesQuestions.size();
DecimalFormat dt = new DecimalFormat("0.##");
Map<String, Object> map = new HashMap<>();
map.put("totalTopic", size);
map.put("totalRight", totalRight);
map.put("totalWrong", size == 0 ? 0 : resourcesQuestions.size() - totalRight);
map.put("totalScore", totalScore);
map.put("accuracy", size == 0 ? 0 : dt.format(BigDecimal.valueOf(totalRight).divide(new BigDecimal(size), 2, RoundingMode.UP).multiply(BigDecimal.valueOf(100))));
return JsonResult.success(map);
}
/**
*

Loading…
Cancel
Save