PERF: Don't build wizard until we actually load the wizard.

This commit is contained in:
Guo Xiang Tan 2016-11-01 15:24:07 +08:00
parent e07dfe16d7
commit 637c474f4e
1 changed files with 6 additions and 2 deletions

View File

@ -82,11 +82,15 @@ class Wizard
.where.not(auth_token_updated_at: nil) .where.not(auth_token_updated_at: nil)
.order(:auth_token_updated_at) .order(:auth_token_updated_at)
@user.present? && first_admin.first == @user && !completed? && (Topic.count < 15) if @user.present? && first_admin.first == @user && (Topic.count < 15)
!Wizard::Builder.new(@user).build.completed?
else
false
end
end end
def self.user_requires_completion?(user) def self.user_requires_completion?(user)
Wizard::Builder.new(user).build.requires_completion? self.new(user).requires_completion?
end end
end end