|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.ibeetl.jlw.entity;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import com.ibeetl.admin.core.entity.BaseEntity;
|
|
|
|
|
import lombok.Data;
|
|
|
|
|
import lombok.EqualsAndHashCode;
|
|
|
|
@ -52,7 +53,7 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity {
|
|
|
|
|
"@} \n" +
|
|
|
|
|
"and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# "
|
|
|
|
|
)
|
|
|
|
|
private int questionTotalCount;
|
|
|
|
|
private Integer questionTotalCount;
|
|
|
|
|
|
|
|
|
|
// 答对数量
|
|
|
|
|
|
|
|
|
@ -65,7 +66,7 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity {
|
|
|
|
|
"and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " +
|
|
|
|
|
"and t.teacher_open_course_question_log_answer = t.question_answer "
|
|
|
|
|
)
|
|
|
|
|
private int correctCount;
|
|
|
|
|
private Integer correctCount;
|
|
|
|
|
|
|
|
|
|
// 答错数量
|
|
|
|
|
@FetchSql("select count(1) from teacher_open_course_question_log t " +
|
|
|
|
@ -76,7 +77,7 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity {
|
|
|
|
|
"and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " +
|
|
|
|
|
"and t.teacher_open_course_question_log_answer != t.question_answer "
|
|
|
|
|
)
|
|
|
|
|
private int wrongCount;
|
|
|
|
|
private Integer wrongCount;
|
|
|
|
|
|
|
|
|
|
// 总得分
|
|
|
|
|
@FetchSql("select sum(IFNULL(t.question_score, 0)) as total_score " +
|
|
|
|
@ -96,7 +97,7 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity {
|
|
|
|
|
|
|
|
|
|
@FetchSql(value = "SELECT t.* " +
|
|
|
|
|
"FROM teacher_open_course_question_log t " +
|
|
|
|
|
"WHERE t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" +
|
|
|
|
|
"WHERE t.teacher_open_course_question_log_status = 1 \n" +
|
|
|
|
|
"@if(!isEmpty(studentId)) { \n" +
|
|
|
|
|
"and t.student_id = #studentId# \n" +
|
|
|
|
|
"@} \n" +
|
|
|
|
@ -107,28 +108,39 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity {
|
|
|
|
|
/**
|
|
|
|
|
* 完成用时
|
|
|
|
|
*/
|
|
|
|
|
@FetchSql(value = "SELECT max(TIMEDIFF( t.teacher_open_course_question_log_update_time , t.teacher_open_course_question_log_add_time )) as finish_time " +
|
|
|
|
|
// @FetchSql(value = "SELECT max(TIMEDIFF( t.teacher_open_course_question_log_update_time , t.teacher_open_course_question_log_add_time )) as finish_time " +
|
|
|
|
|
// "FROM teacher_open_course_question_log t " +
|
|
|
|
|
// "WHERE t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" +
|
|
|
|
|
// "@if(!isEmpty(studentId)) { \n" +
|
|
|
|
|
// "and t.student_id = #studentId# \n" +
|
|
|
|
|
// "@} \n" +
|
|
|
|
|
// "and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " +
|
|
|
|
|
// "AND t.teacher_open_course_question_log_update_time IS NOT NULL "
|
|
|
|
|
// )
|
|
|
|
|
// private String finishTime;
|
|
|
|
|
|
|
|
|
|
@FetchSql(value = "SELECT max(ifnull(t.teacher_open_course_question_log_finish_time , 0)) as finish_time " +
|
|
|
|
|
"FROM teacher_open_course_question_log t " +
|
|
|
|
|
"WHERE t.teacher_open_course_question_log_status = 1 and t.question_log_add_type = 'FINALLY_SUBMIT' \n" +
|
|
|
|
|
"@if(!isEmpty(studentId)) { \n" +
|
|
|
|
|
"and t.student_id = #studentId# \n" +
|
|
|
|
|
"@} \n" +
|
|
|
|
|
"and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId#" +
|
|
|
|
|
"and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# " +
|
|
|
|
|
"AND t.teacher_open_course_question_log_update_time IS NOT NULL "
|
|
|
|
|
)
|
|
|
|
|
private String finishTime;
|
|
|
|
|
|
|
|
|
|
public void setCorrectCount(int correctCount) {
|
|
|
|
|
public void setCorrectCount(Integer correctCount) {
|
|
|
|
|
this.correctCount = correctCount;
|
|
|
|
|
tryCalcCorrectRate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setWrongCount(int wrongCount) {
|
|
|
|
|
public void setWrongCount(Integer wrongCount) {
|
|
|
|
|
this.wrongCount = wrongCount;
|
|
|
|
|
tryCalcCorrectRate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setQuestionTotalCount(int questionTotalCount) {
|
|
|
|
|
public void setQuestionTotalCount(Integer questionTotalCount) {
|
|
|
|
|
this.questionTotalCount = questionTotalCount;
|
|
|
|
|
tryCalcCorrectRate();
|
|
|
|
|
}
|
|
|
|
@ -137,16 +149,10 @@ public class TeacherOpenCourseQuestionLogScoreInfo extends BaseEntity {
|
|
|
|
|
* 尝试计算正确率
|
|
|
|
|
*/
|
|
|
|
|
private void tryCalcCorrectRate() {
|
|
|
|
|
int sumTotalCount = getCorrectCount() + getWrongCount();
|
|
|
|
|
if (sumTotalCount == 0) {
|
|
|
|
|
this.setCorrectRate(0); return;
|
|
|
|
|
}
|
|
|
|
|
if (getQuestionTotalCount() == sumTotalCount) {
|
|
|
|
|
if (ObjectUtil.isAllNotEmpty(getCorrectCount(), getWrongCount(), getQuestionTotalCount())) {
|
|
|
|
|
// 计算正确率, 取小数点后2位数
|
|
|
|
|
// 计算规则:正确率 = 正确数量 / (正确数量 + 错误数量) * 100
|
|
|
|
|
this.setCorrectRate(NumberUtil
|
|
|
|
|
.round(NumberUtil.div(getCorrectCount(), sumTotalCount) * 100, 2)
|
|
|
|
|
.floatValue());
|
|
|
|
|
this.setCorrectRate(NumberUtil.round(((float)getCorrectCount() / getQuestionTotalCount()) * 100, 2).floatValue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|