DEV: Apply syntax_tree formatting to lib/*

This commit is contained in:
David Taylor
2023-01-09 12:10:19 +00:00
parent b0fda61a8e
commit 6417173082
507 changed files with 16550 additions and 12627 deletions

View File

@@ -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