mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-08 23:18:18 -07:00
Autoformat code with rubocop
This commit is contained in:
parent
68dde8a6ef
commit
ed7a3b8a3d
43 changed files with 112 additions and 114 deletions
|
|
@ -14,5 +14,4 @@ class AcademicYear < ActiveRecord::Base
|
|||
years = range.split('-')
|
||||
"#{years.first} – 20#{years.second}"
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ class Category < ActiveRecord::Base
|
|||
include FriendlyId
|
||||
friendly_id :name, use: [:slugged]
|
||||
|
||||
scope :sorted, -> { order(:sort_index)}
|
||||
scope :sorted, -> { order(:sort_index) }
|
||||
|
||||
has_many :subcategories
|
||||
has_many :measures, through: :subcategories
|
||||
|
|
|
|||
|
|
@ -58,9 +58,9 @@ module Legacy
|
|||
|
||||
def save_response(answer_index: nil, twilio_details: nil, responded_at: Time.new)
|
||||
update(
|
||||
answer_index: answer_index,
|
||||
twilio_details: twilio_details,
|
||||
responded_at: responded_at
|
||||
answer_index:,
|
||||
twilio_details:,
|
||||
responded_at:
|
||||
)
|
||||
|
||||
recipient_schedule.update(next_attempt_at: Time.new) if recipient_schedule.queued_question_ids.present?
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ module Legacy
|
|||
validates :option4, presence: true
|
||||
validates :option5, presence: true
|
||||
|
||||
scope :for_category, ->(category) { where(category: category) }
|
||||
scope :for_category, ->(category) { where(category:) }
|
||||
scope :created_in, ->(year) { where("extract(year from #{table_name}.created_at) = ?", year) }
|
||||
|
||||
enum target_group: %i[unknown for_students for_teachers for_parents]
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ module Legacy
|
|||
after_initialize :set_question_id_array
|
||||
|
||||
def questions
|
||||
question_id_array.collect { |id| Question.where(id: id).first }.compact
|
||||
question_id_array.collect { |id| Question.where(id:).first }.compact
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ module Legacy
|
|||
|
||||
validates :name, presence: true
|
||||
|
||||
scope :for_school, ->(school) { where(school: school) }
|
||||
scope :for_school, ->(school) { where(school:) }
|
||||
scope :created_in, ->(year) { where('extract(year from recipients.created_at) = ?', year) }
|
||||
|
||||
before_destroy :sync_lists
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ module Legacy
|
|||
after_save :sync_recipient_schedules
|
||||
|
||||
def recipients
|
||||
recipient_id_array.collect { |id| school.recipients.where(id: id).first }
|
||||
recipient_id_array.collect { |id| school.recipients.where(id:).first }
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ module Legacy
|
|||
return if recipient.opted_out?
|
||||
return if question.nil?
|
||||
|
||||
return attempt_question(question: question) unless question.for_recipient_students?
|
||||
return attempt_question(question:) unless question.for_recipient_students?
|
||||
|
||||
missing_students = []
|
||||
recipient_attempts = attempts.for_recipient(recipient).for_question(question)
|
||||
|
|
@ -60,9 +60,9 @@ module Legacy
|
|||
end
|
||||
|
||||
attempt = recipient.attempts.create(
|
||||
schedule: schedule,
|
||||
schedule:,
|
||||
recipient_schedule: self,
|
||||
question: question,
|
||||
question:,
|
||||
student: missing_students.first
|
||||
)
|
||||
|
||||
|
|
@ -101,12 +101,12 @@ module Legacy
|
|||
return if question.nil? && unanswered_attempt.nil?
|
||||
|
||||
if unanswered_attempt.nil?
|
||||
return attempt_question_for_recipient_students(question: question) if question.for_recipient_students?
|
||||
return attempt_question_for_recipient_students(question:) if question.for_recipient_students?
|
||||
|
||||
attempt = recipient.attempts.create(
|
||||
schedule: schedule,
|
||||
schedule:,
|
||||
recipient_schedule: self,
|
||||
question: question
|
||||
question:
|
||||
)
|
||||
end
|
||||
|
||||
|
|
@ -159,9 +159,9 @@ module Legacy
|
|||
end
|
||||
|
||||
schedule.recipient_schedules.create(
|
||||
recipient_id: recipient_id,
|
||||
recipient_id:,
|
||||
upcoming_question_ids: question_ids.join(','),
|
||||
next_attempt_at: next_attempt_at
|
||||
next_attempt_at:
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ module Legacy
|
|||
validates_associated :school_category
|
||||
|
||||
scope :for, ->(school, question) { where(school_id: school.id, question_id: question.id) }
|
||||
scope :in, ->(year) { where(year: year) }
|
||||
scope :in, ->(year) { where(year:) }
|
||||
|
||||
def sync_attempts
|
||||
attempt_data = Attempt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue