diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 4e7cf0ce9..0d9206738 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -151,7 +151,7 @@ class WelcomeController < ApplicationController def entry_select #@first_page = FirstPage.where("page_type = 'project'").first url = request.original_url.gsub('/','') - if url.include?(Setting.host_course) + if url.include?(Setting.host_course.gsub('/','')) if @first_page.show_course == 1 course render :course @@ -160,7 +160,7 @@ class WelcomeController < ApplicationController end return 0 - elsif url.include?(Setting.host_contest) + elsif url.include?(Setting.host_contest.gsub('/','')) if @first_page.show_contest == 1 contest render :contest @@ -169,7 +169,7 @@ class WelcomeController < ApplicationController end return 0 - elsif url.include?(Setting.host_user) + elsif url.include?(Setting.host_user.gsub('/','')) redirect_to(:controller => "users", :action => "index") end diff --git a/app/models/changeset.rb b/app/models/changeset.rb index f2228e699..123de1bf3 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -307,8 +307,11 @@ class Changeset < ActiveRecord::Base UserScore.project(:push_code, self.user,self, { changeset_id: self.id }) #更新用户等级 UserLevels.update_user_level(self.user) - update_changeset(self.user,1) - update_changeset(self.user,2,self.repository.project) + unless self.user.nil? + update_changeset(self.user,1) + update_changeset(self.user,2,self.repository.project) + end + end #积分刷新