diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 99f942146..5753dd462 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -13,7 +13,7 @@ class CoursesController < ApplicationController before_action :require_login, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups, :left_banner, :top_banner] - before_action :check_account, only: [:new, :apply_to_join_course] + before_action :check_account, only: [:new, :create, :apply_to_join_course] before_action :check_auth, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups, :left_banner, :top_banner, :apply_to_join_course, :exit_course] before_action :set_course, :user_course_identity, only: [:show, :update, :destroy, :settings, :set_invite_code_halt, @@ -927,12 +927,12 @@ class CoursesController < ApplicationController role = course_message.content == 2 ? '7' : '9' # 7:助教 9:教师 ApplyTeacherRoleJoinCourseNotifyJob.perform_later(current_user.id, course.id, role) - teacher_role = 1 message = "#{course_message.content == 2 ? '助教' : '教师'}申请已提交,请等待审核" else message = "#{existing_course_message.content == 2 ? '助教' : '教师'}申请已提交,请等待审核" end end + teacher_role = 1 end if teacher_role && current_user.student_of_course?(course) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 2f40f3fc2..29f270a34 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -113,14 +113,14 @@ class HomeworkCommonsController < ApplicationController else if @user_course_identity == Course::STUDENT @work = @homework.user_work(current_user.id) - work = @homework.student_works.find_by(user_id: current_user.id) - # 学生访问列表时计算个人成绩 - myshixun = Myshixun.find_by(shixun_id: @shixun.id, user_id: current_user.id) - if work && myshixun - challenge_settings = @homework.homework_challenge_settings - games = myshixun.games.where(challenge_id: challenge_settings.pluck(:challenge_id)) - HomeworksService.new.update_myshixun_work_score work, myshixun, games, @homework, challenge_settings + if @homework.homework_type == "practice" + myshixun = Myshixun.find_by(shixun_id: @shixun.id, user_id: current_user.id) + if @work && myshixun + challenge_settings = @homework.homework_challenge_settings + games = myshixun.games.where(challenge_id: challenge_settings.pluck(:challenge_id)) + HomeworksService.new.update_myshixun_work_score @work, myshixun, games, @homework, challenge_settings + end end # 学生已提交作品且补交(提交)已截止、作品公开、非匿评阶段 diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 11016cfbb..1c272e02d 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -3,7 +3,7 @@ class ShixunsController < ApplicationController include ApplicationHelper before_action :require_login, :check_auth, except: [:download_file, :index, :menus] - before_action :check_account, only: [:new, :shixun_exec] + before_action :check_account, only: [:new, :create, :shixun_exec] before_action :check_auth, except: [:download_file, :index, :menus] diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 586b7352f..bc5b0a607 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -1,7 +1,7 @@ class SubjectsController < ApplicationController before_action :require_login, :check_auth, except: [:index] # before_action :check_auth, except: [:index] - before_action :check_account, only: [:new] + before_action :check_account, only: [:new, :create] before_action :find_subject, except: [:index, :create, :new, :append_to_stage] before_action :allowed, only: [:update, :edit, :destroy, :publish, :cancel_publish, :cancel_has_publish, :search_members, :add_subject_members, :statistics, :shixun_report, :school_report,