|
@@ -160,6 +160,7 @@ public class QuestionFlowService {
|
|
|
switch(courseModule){
|
|
|
case VS:
|
|
|
userPaper.setTitle(assign.getTitle());
|
|
|
+ break;
|
|
|
case VIDEO:
|
|
|
case ONLINE:
|
|
|
default:
|
|
@@ -553,6 +554,21 @@ public class QuestionFlowService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 获取未完成试卷
|
|
|
+ * @param userId
|
|
|
+ * @param paper
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Integer needContinueReport(Integer userId, UserPaper paper){
|
|
|
+ UserReport userReport = userReportService.getLastByPaper(userId, paper.getId());
|
|
|
+ if (userReport == null) return 0;
|
|
|
+ if (userReport.getDetail() != null && userReport.getFinishTime() != null){
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return userReport.getId();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 开始新一轮做题
|
|
|
* @param userId
|
|
|
* @param origin
|
|
@@ -578,10 +594,13 @@ public class QuestionFlowService {
|
|
|
}else{
|
|
|
paper = userPaperService.add(paper);
|
|
|
}
|
|
|
- }else if(setting == null){
|
|
|
- // 对于长难句这种没有设置开始页的,读取最后一次
|
|
|
+ }else{
|
|
|
userReport = userReportService.getLastByPaper(userId, paper.getId());
|
|
|
+ if (userReport != null && userReport.getFinishTime() != null){
|
|
|
+ userReport = null;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
if (userReport == null){
|
|
|
userReport = userReportService.newByPaper(paper, setting);
|
|
|
userReport.setTimes(paper.getTimes() + 1);
|
|
@@ -637,7 +656,7 @@ public class QuestionFlowService {
|
|
|
*/
|
|
|
@Transactional
|
|
|
public UserQuestion next(Integer userId, Integer userReportId){
|
|
|
- UserQuestion userQuestion = userQuestionService.getLastByReport(userId, userReportId);
|
|
|
+ UserQuestion userQuestion = userQuestionService.getLastByReportWithAuto(userId, userReportId);
|
|
|
// 查找未完成的questionId
|
|
|
if (userQuestion==null || userQuestion.getUserTime() >0 || userQuestion.getIsAuto() == 1){
|
|
|
// 创建新的question
|
|
@@ -693,6 +712,7 @@ public class QuestionFlowService {
|
|
|
if (userQuestion.getUserAnswer()!=null){
|
|
|
userReportService.accumulation(userQuestion);
|
|
|
}
|
|
|
+ userReportService.edit(UserReport.builder().id(userReport.getId()).build());
|
|
|
|
|
|
// 自动finish
|
|
|
if (userReport.getQuestionNumber().equals(userReport.getUserNumber())){
|
|
@@ -945,7 +965,7 @@ public class QuestionFlowService {
|
|
|
// 根据设置出题
|
|
|
Integer questionNoId = 0;
|
|
|
if (paper.getIsAdapt() > 0){
|
|
|
- List<String> questionTypes = QuestionType.SpecialFromSubject(subject);
|
|
|
+ List<String> questionTypes = QuestionType.FromSubject(subject);
|
|
|
List<UserQuestion> userQuestionList = userQuestionService.listByReportAndType(report.getUserId(), report.getId(), questionTypes);
|
|
|
Collection ids = Transform.getIds(userQuestionList, UserQuestion.class, "questionNoId");
|
|
|
|
|
@@ -1075,7 +1095,7 @@ public class QuestionFlowService {
|
|
|
// 计算上阶段的做题情况
|
|
|
long correct = subQuestionList.stream().filter((x)->questionNoIds.contains(x.getQuestionNoId()) && x.getIsCorrect() > 0).count();
|
|
|
// 下一阶段
|
|
|
- Integer level = examinationService.quantNextLevel(info.getInteger("level"), examinationService.quantBaseLevel[step], correct, step);
|
|
|
+ Integer level = examinationService.quantNextLevel(info.getInteger("level"), examinationService.quantBaseLevel[nextStep], correct, nextStep);
|
|
|
Map<String, Integer> typeNumber = examinationService.statTypeNumber(subQuestionList);
|
|
|
info = examinationService.generateQuant(paper.getStructThree(), level, typeNumber, ids, nextStep);
|
|
|
steps.add(info);
|
|
@@ -1119,7 +1139,7 @@ public class QuestionFlowService {
|
|
|
}else{
|
|
|
number = 3;
|
|
|
}
|
|
|
- Integer[] questions = questionNoService.randomExaminationRc(paper.getStructThree(), number, rc.values());
|
|
|
+ Integer[] questions = questionNoService.randomExaminationRc(paper.getStructThree(), number, null, rc.values());
|
|
|
// 写入后续题目关系
|
|
|
Integer position = subnumber;
|
|
|
for(int q: questions){
|
|
@@ -1781,6 +1801,7 @@ public class QuestionFlowService {
|
|
|
type.put("difficult", new JSONObject());
|
|
|
JSONObject initTypeInfo = new JSONObject();
|
|
|
// 初始化题型基础信息
|
|
|
+ initTypeInfo.put("questionNumber", 0);
|
|
|
initTypeInfo.put("userNumber", 0);
|
|
|
initTypeInfo.put("userTime", 0);
|
|
|
initTypeInfo.put("userCorrect", 0);
|
|
@@ -1855,9 +1876,9 @@ public class QuestionFlowService {
|
|
|
if (userQuestion.getIsAuto()==0) {
|
|
|
difficult.put("userNumber", difficult.getInteger("userNumber") + 1);
|
|
|
difficult.put("userCorrect", difficult.getInteger("userCorrect") + userQuestion.getIsCorrect());
|
|
|
- difficult.put("totalNumber", difficult.getInteger("totalNumber") + relation.getTotalNumber() + 1);
|
|
|
- difficult.put("totalCorrect", difficult.getInteger("totalCorrect") + relation.getTotalCorrect() + userQuestion.getIsCorrect());
|
|
|
}
|
|
|
+ difficult.put("totalNumber", difficult.getInteger("totalNumber") + relation.getTotalNumber() + 1);
|
|
|
+ difficult.put("totalCorrect", difficult.getInteger("totalCorrect") + relation.getTotalCorrect() + userQuestion.getIsCorrect());
|
|
|
|
|
|
difficult = difficultSubjectMap.getJSONObject(difficultKey);
|
|
|
if (difficult == null){
|
|
@@ -1872,9 +1893,9 @@ public class QuestionFlowService {
|
|
|
if (userQuestion.getIsAuto()==0){
|
|
|
difficult.put("userNumber", difficult.getInteger("userNumber") + 1);
|
|
|
difficult.put("userCorrect", difficult.getInteger("userCorrect") + userQuestion.getIsCorrect());
|
|
|
- difficult.put("totalNumber", difficult.getInteger("totalNumber") + relation.getTotalNumber() + 1);
|
|
|
- difficult.put("totalCorrect", difficult.getInteger("totalCorrect") + relation.getTotalCorrect() + userQuestion.getIsCorrect());
|
|
|
}
|
|
|
+ difficult.put("totalNumber", difficult.getInteger("totalNumber") + relation.getTotalNumber() + 1);
|
|
|
+ difficult.put("totalCorrect", difficult.getInteger("totalCorrect") + relation.getTotalCorrect() + userQuestion.getIsCorrect());
|
|
|
|
|
|
// 基础数据
|
|
|
if (userQuestion.getIsAuto()==0) {
|
|
@@ -1882,6 +1903,7 @@ public class QuestionFlowService {
|
|
|
typeInfo.put("userTime", typeInfo.getIntValue("userTime") + userQuestion.getUserTime());
|
|
|
typeInfo.put("userCorrect", typeInfo.getIntValue("userCorrect") + userQuestion.getIsCorrect());
|
|
|
}
|
|
|
+ typeInfo.put("questionNumber", typeInfo.getInteger("questionNumber") + 1);
|
|
|
|
|
|
if (userQuestion.getIsCorrect() > 0){
|
|
|
typeInfo.put("correctTime", typeInfo.getIntValue("correctTime")+userQuestion.getUserTime());
|
|
@@ -1921,13 +1943,13 @@ public class QuestionFlowService {
|
|
|
JSONObject type = typeMap.getJSONObject(key);
|
|
|
JSONObject typeInfo = type.getJSONObject("info");
|
|
|
typeInfo.put("avgDiffCorrect", toolsService.avgDiffScore(typeInfo.getFloat("diffCorrect"), typeInfo.getIntValue("userCorrect")));
|
|
|
- typeInfo.put("avgDiffIncorrect", toolsService.avgDiffScore(typeInfo.getFloat("diffIncorrect"), typeInfo.getIntValue("userNumber") - typeInfo.getIntValue("userCorrect")));
|
|
|
+ typeInfo.put("avgDiffIncorrect", toolsService.avgDiffScore(typeInfo.getFloat("diffIncorrect"), typeInfo.getIntValue("questionNumber") - typeInfo.getIntValue("userCorrect")));
|
|
|
}
|
|
|
for (String key : subjectMap.keySet()) {
|
|
|
JSONObject subject = subjectMap.getJSONObject(key);
|
|
|
JSONObject subjectInfo = subject.getJSONObject("info");
|
|
|
subjectInfo.put("avgDiffCorrect", toolsService.avgDiffScore(subjectInfo.getFloat("diffCorrect"), subjectInfo.getIntValue("userCorrect")));
|
|
|
- subjectInfo.put("avgDiffIncorrect", toolsService.avgDiffScore(subjectInfo.getFloat("diffIncorrect"), subjectInfo.getIntValue("userNumber") - subjectInfo.getIntValue("userCorrect")));
|
|
|
+ subjectInfo.put("avgDiffIncorrect", toolsService.avgDiffScore(subjectInfo.getFloat("diffIncorrect"), subjectInfo.getIntValue("questionNumber") - subjectInfo.getIntValue("userCorrect")));
|
|
|
}
|
|
|
|
|
|
// 学科得分计算
|
|
@@ -1937,17 +1959,17 @@ public class QuestionFlowService {
|
|
|
JSONObject quantSubject = subjectMap.getJSONObject(QuestionSubject.QUANT.key);
|
|
|
if (quantSubject != null){
|
|
|
JSONObject quantInfo = quantSubject.getJSONObject("info");
|
|
|
- quantScore = toolsService.quantScore(quantInfo.getIntValue("number"), quantInfo.getIntValue("userNumber"), quantInfo.getFloatValue("difficultScore"), quantInfo.getInteger("userCorrect"));
|
|
|
+ quantScore = toolsService.quantScore(quantInfo.getIntValue("questionNumber"), quantInfo.getIntValue("userNumber"), quantInfo.getFloatValue("difficultScore"), quantInfo.getInteger("userCorrect"));
|
|
|
}
|
|
|
JSONObject verbalSubject = subjectMap.getJSONObject(QuestionSubject.VERBAL.key);
|
|
|
if (verbalSubject != null){
|
|
|
JSONObject verbalInfo = verbalSubject.getJSONObject("info");
|
|
|
- verbalScore = toolsService.verbalScore(verbalInfo.getIntValue("number"), verbalInfo.getIntValue("userNumber"), verbalInfo.getFloatValue("difficultScore"), verbalInfo.getInteger("userCorrect"));
|
|
|
+ verbalScore = toolsService.verbalScore(verbalInfo.getIntValue("questionNumber"), verbalInfo.getIntValue("userNumber"), verbalInfo.getFloatValue("difficultScore"), verbalInfo.getInteger("userCorrect"));
|
|
|
}
|
|
|
JSONObject irSubject = subjectMap.getJSONObject(QuestionSubject.IR.key);
|
|
|
if (irSubject != null){
|
|
|
JSONObject irInfo = irSubject.getJSONObject("info");
|
|
|
- irScore = toolsService.irScore(irInfo.getIntValue("number"), irInfo.getIntValue("userNumber"), irInfo.getInteger("difficultScore"), irInfo.getInteger("userCorrect"));
|
|
|
+ irScore = toolsService.irScore(irInfo.getIntValue("questionNumber"), irInfo.getIntValue("userNumber"), irInfo.getInteger("difficultScore"), irInfo.getInteger("userCorrect"));
|
|
|
}
|
|
|
|
|
|
Rank rank = toolsService.totalScore(quantScore, verbalScore);
|
|
@@ -1956,6 +1978,7 @@ public class QuestionFlowService {
|
|
|
score.put("quantScore", quantScore);
|
|
|
score.put("quantRank", rank.getQuantRank());
|
|
|
score.put("verbalScore", verbalScore);
|
|
|
+ score.put("verbalRank", rank.getVerbalRank());
|
|
|
score.put("irScore", irScore);
|
|
|
score.put("irRank", rank.getIrRank());
|
|
|
|