Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ public interface IUserOverviewRepository {
"where user_id = #{userId} and create_time >= subdate(now(), 14) and question_status = 0 " +
"group by knowledge_point_id " +
"having count(knowledge_point_id) >= 3")
int getHardQuestions(String userId);
Integer getHardQuestions(String userId);

@Select("select count(id) from MistakeQuestion " +
"where user_id = #{userId}")
int getQuestionsNum(String userId);
Integer getQuestionsNum(String userId);

@Select("select count(id) from MistakeQuestion " +
"where user_id = #{userId} and question_status = 1")
int getHardQuestionsNum(String userId);
Integer getHardQuestionsNum(String userId);

@Update("update UserData set hard_questions = #{hardQuestions}, " +
"questions_num = #{questionsNum}, " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ public void handleUserOverview() {
List<String> userIds = userOverviewRepository.getUserIds();
for (String userId : userIds) {
//查询用户易错知识点数
int hardQuestions = userOverviewRepository.getHardQuestions(userId);
Integer count = userOverviewRepository.getHardQuestions(userId);
int hardQuestions = count != null ? count : 0;
//查询用户总错题数
int questionsNum = userOverviewRepository.getQuestionsNum(userId);
count = userOverviewRepository.getQuestionsNum(userId);
int questionsNum = count != null ? count : 0;
//查询用户已掌握错题数
int hardQuestionsNum = userOverviewRepository.getHardQuestionsNum(userId);
count = userOverviewRepository.getHardQuestionsNum(userId);
int hardQuestionsNum = count != null ? count : 0;

double reviewRate = questionsNum == 0 ? 0 : hardQuestionsNum * 1.0 / questionsNum;

Expand Down
Loading