mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
tweaking texting format
This commit is contained in:
parent
f2141fb6dc
commit
aa06f301df
3 changed files with 8 additions and 10 deletions
|
|
@ -23,16 +23,14 @@ class Attempt < ApplicationRecord
|
|||
|
||||
def messages
|
||||
if student.present?
|
||||
intro = "#{student.name}'s school, "
|
||||
intro = "From #{student.name}'s school:"
|
||||
else
|
||||
intro = "Your child's school, "
|
||||
intro = "From your child's school:"
|
||||
end
|
||||
|
||||
intro += "#{recipient.school.name}, would love your opinion on this question:"
|
||||
|
||||
[
|
||||
#question.text,
|
||||
"#{intro}\n\r#{question.text}\n\r#{question.option1}: Reply 1\n\r#{question.option2}: Reply 2\n\r#{question.option3}: Reply 3\n\r#{question.option4}: Reply 4\n\r#{question.option5}: Reply 5\n\rReply 'skip' to skip this question.\n\rReply 'stop' to stop these messages."
|
||||
"#{intro}\n\r#{question.text}\n\rReply with:\n\r1: #{question.option1}\n\r2: #{question.option2}\n\r3: #{question.option3}\n\r4: #{question.option4}\n\r5: #{question.option5}\n\r'skip' skips question, 'stop' stops all questions"
|
||||
]
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -257,18 +257,18 @@ describe "survey:attempt_questions" do
|
|||
end
|
||||
|
||||
it 'should mention the students name in the text' do
|
||||
expect(FakeSMS.messages[1].body).to match(/Student0's school, School, would love your opinion on this question/)
|
||||
expect(FakeSMS.messages[1].body).to match(/From Student0's school:/)
|
||||
end
|
||||
|
||||
it 'should not mention the students name in the text if the recipient has no student specified' do
|
||||
expect(FakeSMS.messages[0].body).to match(/Your child's school, School, would love your opinion on this question/)
|
||||
expect(FakeSMS.messages[0].body).to match(/From your child's school:/)
|
||||
end
|
||||
|
||||
it 'resends the question about the same student if not responded to' do
|
||||
message_count = FakeSMS.messages.length
|
||||
expect{students_recipient_schedule.attempt_question}.to change{students_recipient.attempts.count}.by(0)
|
||||
expect(FakeSMS.messages.length).to eq(message_count + 1)
|
||||
expect(FakeSMS.messages.last.body).to match(/Student0's school, School/)
|
||||
expect(FakeSMS.messages.last.body).to match(/From Student0's school:/)
|
||||
expect(FakeSMS.messages.last.body).to match(questions.first.text)
|
||||
end
|
||||
|
||||
|
|
@ -290,7 +290,7 @@ describe "survey:attempt_questions" do
|
|||
|
||||
it 'should not mention the students name in the text' do
|
||||
FakeSMS.messages.each do |message|
|
||||
expect(message.body).to match(/Your child's school, School, would love your opinion on this question/)
|
||||
expect(message.body).to match(/From your child's school:/)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ RSpec.describe Attempt, type: :model do
|
|||
# expect(FakeSMS.messages.first.body).to eq("Question 0:1")
|
||||
|
||||
expect(FakeSMS.messages.last.to).to eq('111111111')
|
||||
expect(FakeSMS.messages.last.body).to eq("Your child's school, School, would love your opinion on this question:\n\rQuestion 0:1\n\rOption 0:1 A: Reply 1\n\rOption 0:1 B: Reply 2\n\rOption 0:1 C: Reply 3\n\rOption 0:1 D: Reply 4\n\rOption 0:1 E: Reply 5\n\rReply 'skip' to skip this question.\n\rReply 'stop' to stop these messages.")
|
||||
expect(FakeSMS.messages.last.body).to eq("From your child's school:\n\rQuestion 0:1\n\rReply with:\n\r1: Option 0:1 A\n\r2: Option 0:1 B\n\r3: Option 0:1 C\n\r4: Option 0:1 D\n\r5: Option 0:1 E\n\r'skip' skips question, 'stop' stops all questions")
|
||||
end
|
||||
|
||||
it 'should update sent_at' do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue