From 7a3151239e6c4d847b75c407590367e0b593f6b4 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 26 Jul 2019 14:55:43 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=B9=9F=E9=9C=80=E8=A6=81=E5=81=9A=E5=AE=8C=E5=96=84=E8=B5=84?= =?UTF-8?q?=E6=96=99=E7=9A=84=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 +- app/controllers/shixuns_controller.rb | 2 +- app/controllers/subjects_controller.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 99f942146..e3a9f60e7 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, diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 1999c473f..5876cb54b 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, From c71da9b6ae8f2330da1c220ecd472c74f829a890 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 26 Jul 2019 15:12:50 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E8=BF=9B=E5=85=A5?= =?UTF-8?q?=E8=AF=BE=E5=A0=82=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index e3a9f60e7..5753dd462 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -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) From 3c5133bcb8cf04006f52ba3945a5da5642dda943 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 26 Jul 2019 15:17:56 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_commons_controller.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 # 学生已提交作品且补交(提交)已截止、作品公开、非匿评阶段