mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-08 23:18:18 -07:00
adding students to seeds
This commit is contained in:
parent
36d061fca2
commit
4ed8aa00bb
3 changed files with 31 additions and 8 deletions
|
|
@ -31,6 +31,18 @@ class RecipientSchedule < ApplicationRecord
|
|||
Question.where(id: next_question_id).first
|
||||
end
|
||||
|
||||
def upcoming_question_id_array
|
||||
upcoming_question_ids.try(:split, /,/) || []
|
||||
end
|
||||
|
||||
def attempted_question_id_array
|
||||
attempted_question_ids.try(:split, /,/) || []
|
||||
end
|
||||
|
||||
def queued_question_id_array
|
||||
queued_question_ids.try(:split, /,/) || []
|
||||
end
|
||||
|
||||
def attempt_question_for_recipient_students(send_message: true, question: next_question)
|
||||
return if recipient.opted_out?
|
||||
return if question.nil?
|
||||
|
|
@ -55,9 +67,9 @@ class RecipientSchedule < ApplicationRecord
|
|||
)
|
||||
|
||||
if send_message && attempt.send_message
|
||||
upcoming = upcoming_question_ids.try(:split, /,/) || []
|
||||
queued = queued_question_ids.try(:split, /,/) || []
|
||||
attempted = attempted_question_ids.try(:split, /,/) || []
|
||||
upcoming = upcoming_question_id_array
|
||||
queued = queued_question_id_array
|
||||
attempted = attempted_question_id_array
|
||||
|
||||
if question.present?
|
||||
question_id = [question.id.to_s]
|
||||
|
|
@ -100,9 +112,9 @@ class RecipientSchedule < ApplicationRecord
|
|||
end
|
||||
|
||||
if send_message && (unanswered_attempt || attempt).send_message
|
||||
upcoming = upcoming_question_ids.try(:split, /,/) || []
|
||||
queued = queued_question_ids.try(:split, /,/) || []
|
||||
attempted = attempted_question_ids.try(:split, /,/) || []
|
||||
upcoming = upcoming_question_id_array
|
||||
queued = queued_question_id_array
|
||||
attempted = attempted_question_id_array
|
||||
|
||||
if question.present?
|
||||
question_id = [question.id.to_s]
|
||||
|
|
|
|||
|
|
@ -21,6 +21,15 @@ recipients = [
|
|||
school.recipients.create(name: 'Lynisse Patin', phone: '19176566892'),
|
||||
school.recipients.create(name: 'Khemenec Patin', phone: '(347) 534-6437'),
|
||||
]
|
||||
|
||||
recipients[0].students.create(name: 'Abigail')
|
||||
recipients[0].students.create(name: 'Clara')
|
||||
|
||||
recipients[3].students.creaet(name: 'Zara')
|
||||
recipients[3].students.creaet(name: 'Cole')
|
||||
recipients[4].students.creaet(name: 'Zara')
|
||||
recipients[4].students.creaet(name: 'Cole')
|
||||
|
||||
recipient_list = school.recipient_lists.create(name: 'Pilot Parent Test', recipient_id_array: recipients.map(&:id))
|
||||
|
||||
user.user_schools.create(school: school)
|
||||
|
|
|
|||
|
|
@ -102,7 +102,8 @@ namespace :data do
|
|||
option2: question['answers'][1],
|
||||
option3: question['answers'][2],
|
||||
option4: question['answers'][3],
|
||||
option5: question['answers'][4]
|
||||
option5: question['answers'][4],
|
||||
for_recipient_students: question['child'].present?
|
||||
)
|
||||
else
|
||||
variations.each do |variation|
|
||||
|
|
@ -112,7 +113,8 @@ namespace :data do
|
|||
option2: question['answers'][1],
|
||||
option3: question['answers'][2],
|
||||
option4: question['answers'][3],
|
||||
option5: question['answers'][4]
|
||||
option5: question['answers'][4],
|
||||
for_recipient_students: question['child'].present?
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue