创建项目的时候创建项目得分记录
This commit is contained in:
parent
e808f0bc61
commit
5fe4e9e813
|
@ -203,6 +203,8 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 注意:修改该方法的时候注意同步修改forked方法
|
||||
# forked方法也会创建项目
|
||||
def create
|
||||
unless User.current.login?
|
||||
redirect_to signin_url
|
||||
|
@ -222,6 +224,11 @@ class ProjectsController < ApplicationController
|
|||
#unless User.current.admin?
|
||||
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
|
||||
m = Member.new(:user => User.current, :roles => [r])
|
||||
# project's score
|
||||
if ProjectScore.where("project_id=?", @project.id).first.nil?
|
||||
ProjectScore.create(:project_id => @project.id, :score => false)
|
||||
end
|
||||
# end
|
||||
project_info = ProjectInfo.new(:user_id => User.current.id, :project_id => @project.id)
|
||||
user_grades = UserGrade.create(:user_id => User.current.id, :project_id => @project.id)
|
||||
Rails.logger.debug "UserGrade created: #{user_grades.to_json}"
|
||||
|
|
|
@ -122,6 +122,9 @@ class RepositoriesController < ApplicationController
|
|||
if project.save
|
||||
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
|
||||
m = Member.new(:user => User.current, :roles => [r])
|
||||
if ProjectScore.where("project_id=?", @project.id).first.nil?
|
||||
ProjectScore.create(:project_id => @project.id, :score => false)
|
||||
end
|
||||
project_info = ProjectInfo.new(:user_id => User.current.id, :project_id => project.id)
|
||||
user_grades = UserGrade.create(:user_id => User.current.id, :project_id => project.id)
|
||||
Rails.logger.debug "UserGrade created: #{user_grades.to_json}"
|
||||
|
|
Loading…
Reference in New Issue