diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index ccd07c811..8333b080d 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -441,6 +441,7 @@ class SubjectsController < ApplicationController def user_subject_progress challenge_ids pass_games = Game.select(:id, :cost_time, :challenge_id).where(status: 2, user_id: current_user.id, challenge_id: challenge_ids) if current_user.logged? + @all_score = Challenge.where(id: challenge_ids).size # 如果没有通关的,没必要再继续统计了 if pass_games.blank? @my_score = 0 @@ -448,7 +449,6 @@ class SubjectsController < ApplicationController @time = 0 @user_tags = [] else - @all_score = Challenge.where(id: challenge_ids).size pass_challenge_ids = pass_games.map(&:challenge_id).uniq # 按道理是不用去重的,但是历史数据与重复 subject_challenge_count = @subject.shixuns.sum(:challenges_count) # 用户通关获得的标签 diff --git a/app/helpers/homework_commons_helper.rb b/app/helpers/homework_commons_helper.rb index 3e9ad2eaa..cc23d05d6 100644 --- a/app/helpers/homework_commons_helper.rb +++ b/app/helpers/homework_commons_helper.rb @@ -239,7 +239,12 @@ module HomeworkCommonsHelper end def student_redo_work work, homework + status = false publish_time = homework.homework_group_setting(work.user_id)&.publish_time - work.myshixun && publish_time && work.myshixun.games.where("status = 2 and answer_open = 1 and end_time <= '#{publish_time}'").count > 0 ? true : false + if work.myshixun && publish_time && work.myshixun.created_at < publish_time && work.myshixun.games.where("answer_open > 0").count > 0 + min_time = Grade.where(container_type: "Answer", container_id: work.myshixun.games.where("answer_open > 0").pluck(:id)).pluck(:created_at).min + status = min_time && min_time < publish_time + end + status end end diff --git a/public/react/src/modules/page/main/CodeRepositoryViewContainer.js b/public/react/src/modules/page/main/CodeRepositoryViewContainer.js index 5d6be306f..c6e7ddc79 100644 --- a/public/react/src/modules/page/main/CodeRepositoryViewContainer.js +++ b/public/react/src/modules/page/main/CodeRepositoryViewContainer.js @@ -254,9 +254,13 @@ class CodeRepositoryViewContainer extends Component { } }) } + if (isCurrentFile) { + if (challenge.pathIndex == cur_index) { + showSnackbar(`当前编辑文件已经是${nodePath}`) + } onPathChange(cur_index) - showSnackbar(`当前编辑文件已经是${nodePath}`) + // showSnackbar(`当前编辑文件已经是${nodePath}`) } else { onPathChange(-1) }