mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Apply syntax_tree formatting to lib/*
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Wizard
|
||||
|
||||
attr_reader :steps, :user
|
||||
attr_accessor :max_topics_to_require_completion
|
||||
|
||||
@@ -64,15 +63,14 @@ class Wizard
|
||||
end
|
||||
|
||||
def start
|
||||
completed = UserHistory.where(
|
||||
action: UserHistory.actions[:wizard_step],
|
||||
context: steps_with_fields.map(&:id)
|
||||
).uniq.pluck(:context)
|
||||
completed =
|
||||
UserHistory
|
||||
.where(action: UserHistory.actions[:wizard_step], context: steps_with_fields.map(&:id))
|
||||
.uniq
|
||||
.pluck(:context)
|
||||
|
||||
# First uncompleted step
|
||||
steps_with_fields.each do |s|
|
||||
return s unless completed.include?(s.id)
|
||||
end
|
||||
steps_with_fields.each { |s| return s unless completed.include?(s.id) }
|
||||
|
||||
@first_step
|
||||
end
|
||||
@@ -89,10 +87,12 @@ class Wizard
|
||||
def completed_steps?(steps)
|
||||
steps = [steps].flatten.uniq
|
||||
|
||||
completed = UserHistory.where(
|
||||
action: UserHistory.actions[:wizard_step],
|
||||
context: steps
|
||||
).distinct.order(:context).pluck(:context)
|
||||
completed =
|
||||
UserHistory
|
||||
.where(action: UserHistory.actions[:wizard_step], context: steps)
|
||||
.distinct
|
||||
.order(:context)
|
||||
.pluck(:context)
|
||||
|
||||
steps.sort == completed
|
||||
end
|
||||
@@ -116,5 +116,4 @@ class Wizard
|
||||
def self.user_requires_completion?(user)
|
||||
self.new(user).requires_completion?
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user