diff --git a/app/controllers/gits_controller.rb b/app/controllers/gits_controller.rb index b3ab4c13f..c9659302e 100644 --- a/app/controllers/gits_controller.rb +++ b/app/controllers/gits_controller.rb @@ -38,7 +38,6 @@ class GitsController < ApplicationController else # 用户是否对对象拥有权限 system_user = User.find_by_login(input_username) || User.find_by_mail(input_username) || User.find_by_phone(input_username) - # 如果用户名密码错误 if system_user && !system_user.check_password?(input_password) uid_logger_error("git start: password is wrong") @@ -49,7 +48,7 @@ class GitsController < ApplicationController shixunname = git_url.split("/")[1].split(".")[0] repo_name = username + "/" + shixunname uid_logger("git start: repo_name is #{repo_name}") - shixun = Shixun.select([:id, :user_id, :repo_name, :identifier]).where(repo_name: repo_name, laboratory_id: nil).first + shixun = Shixun.select([:id, :user_id, :repo_name, :identifier]).where(repo_name: repo_name).first uid_logger("git start auth: shixun identifier is #{shixun.try(:identifier)}") uid_logger("git start auth: systemuser is #{system_user.try(:login)}") @@ -64,7 +63,7 @@ class GitsController < ApplicationController else uid_logger_error("shixun is not exist") # result = false - result = true # 为了测试跳出 + result = false # 为了测试跳出 end end end diff --git a/app/services/subjects/copy_subject_service.rb b/app/services/subjects/copy_subject_service.rb index 5f8481cae..94157dc7b 100644 --- a/app/services/subjects/copy_subject_service.rb +++ b/app/services/subjects/copy_subject_service.rb @@ -5,7 +5,8 @@ class Subjects::CopySubjectService < ApplicationService @subject = subject @user = user @laboratory = laboratory - subject_params = subject.attributes.dup.except('id', 'copy_subject_id', 'user_id', 'homepage_show') + subject_params = subject.attributes.dup.except('id', 'copy_subject_id', 'user_id', 'homepage_show', + 'stages_count', 'shixuns_count', 'stage_shixuns_count') @to_subject = Subject.new(subject_params) end @@ -59,7 +60,7 @@ class Subjects::CopySubjectService < ApplicationService shixun = stage_shixun.shixun to_shixun = Shixun.new to_shixun.attributes = shixun.attributes.dup.except('id', 'user_id', 'identifier', 'homepage_show', - 'use_scope', 'averge_star', 'myshixuns_count') + 'use_scope', 'averge_star', 'myshixuns_count', 'challenges_count') to_shixun.identifier = Util::UUID.generate_identifier(Shixun, 8) to_shixun.user_id = user.id if laboratory