Last active
August 29, 2015 14:20
-
-
Save whsieh/77cf342d4829599ebf5a to your computer and use it in GitHub Desktop.
Topic seeding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Seed religion survey questions. | |
topic = Topic.find_by_name "Religion" | |
survey_question = topic.survey_questions.create :text => "Are your beliefs aligned with any mainstream religion (e.g. Christianity, Judaism, Buddhism, Islam, Hinduism, etc.)", :index => 1 | |
responses = [{ | |
:text => "Yes", | |
:summary_text => "I am religious.", | |
:index => 0 | |
}, | |
{ | |
:text => "No", | |
:summary_text => "I am not religious.", | |
:index => 1 | |
}, | |
{ | |
:text => "I don't know; I'm agnostic", | |
:summary_text => "I am agnostic.", | |
:index => 2 | |
}].map { |data| survey_question.survey_responses.create data } | |
ResponseWeight.create :response1_id => responses[0].id, :response2_id => responses[1].id, :weight => 1 | |
ResponseWeight.create :response1_id => responses[0].id, :response2_id => responses[2].id, :weight => 1 | |
ResponseWeight.create :response1_id => responses[1].id, :response2_id => responses[2].id, :weight => 1.5 | |
survey_question = topic.survey_questions.create :text => "How much control should the government have over religious institutions?", :index => 2 | |
responses = [{ | |
:text => "No control", | |
:summary_text => "Government should have no control over religious institutions.", | |
:index => 0 | |
}, | |
{ | |
:text => "Some control over religious events taking place on public property", | |
:summary_text => "Government should have some control over religious events taking place on public property.", | |
:index => 1 | |
}, | |
{ | |
:text => "Control over events where the public has access", | |
:summary_text => "Government should have control over events where the public has access.", | |
:index => 2 | |
}, | |
{ | |
:text => "Control over all religious events", | |
:summary_text => "Government should have control over all religious events.", | |
:index => 3 | |
}].map { |data| survey_question.survey_responses.create data } | |
ResponseWeight.create :response1_id => responses[0].id, :response2_id => responses[1].id, :weight => 0.75 | |
ResponseWeight.create :response1_id => responses[0].id, :response2_id => responses[2].id, :weight => 0.75 | |
ResponseWeight.create :response1_id => responses[0].id, :response2_id => responses[3].id, :weight => 0.25 | |
ResponseWeight.create :response1_id => responses[1].id, :response2_id => responses[2].id, :weight => 0.75 | |
ResponseWeight.create :response1_id => responses[1].id, :response2_id => responses[3].id, :weight => 1.25 | |
ResponseWeight.create :response1_id => responses[2].id, :response2_id => responses[3].id, :weight => 1.5 | |
# Seed education survey questions. | |
topic = Topic.find_by_name "Education" | |
survey_question = topic.survey_questions.create :text => "Should higher education be free for everyone?", :index => 1 | |
responses = [{ | |
:text => "Yes", | |
:summary_text => "I think higher education should not be free for everyone.", | |
:index => 1 | |
}, | |
{ | |
:text => "No", | |
:summary_text => "I think higher education should be free for everyone.", | |
:index => 2 | |
}].map { |data| survey_question.survey_responses.create data } | |
ResponseWeight.create :response1_id => responses[0].id, :response2_id => responses[1].id, :weight => 1 | |
survey_question = topic.survey_questions.create :text => "Which of the following do you agree most strongly with?", :index => 2 | |
responses = [{ | |
:text => "Teachers should dedicate their time to helping struggling students catch up if it means neglecting and possibly impeding advancing students' learning", | |
:summary_text => "I think teachers should dedicate their time to helping struggling students catch up if it means neglecting and possibly impeding advancing students' learning.", | |
:index => 1 | |
}, | |
{ | |
:text => "Teachers should dedicate their time to helping advancing students excel even if it means neglecting and possibly leaving behind struggling students", | |
:summary_text => "I think teachers should dedicate their time to helping advancing students excel even if it means neglecting and possibly leaving behind struggling students.", | |
:index => 2 | |
}, | |
{ | |
:text => "Teachers should ensure that all their students are on the same page so that this problem isn't a problem", | |
:summary_text => "I think teachers should ensure that all their students are on the same page so that this problem isn't a problem.", | |
:index => 3 | |
}, | |
{ | |
:text => "Students should be taught at a rate in which they do not fall behind and can excel if they desire to, even if this means sometimes splitting up classes for parts of the day", | |
:summary_text => "I think students should be taught at a rate in which they do not fall behind and can excel if they desire to, even if this means sometimes splitting up classes for parts of the day.", | |
:index => 4 | |
}].map { |data| survey_question.survey_responses.create data } | |
ResponseWeight.create :response1_id => responses[0].id, :response2_id => responses[1].id, :weight => 1 | |
ResponseWeight.create :response1_id => responses[0].id, :response2_id => responses[2].id, :weight => 0.5 | |
ResponseWeight.create :response1_id => responses[0].id, :response2_id => responses[3].id, :weight => 0.25 | |
ResponseWeight.create :response1_id => responses[1].id, :response2_id => responses[2].id, :weight => 1 | |
ResponseWeight.create :response1_id => responses[1].id, :response2_id => responses[3].id, :weight => 0.5 | |
ResponseWeight.create :response1_id => responses[2].id, :response2_id => responses[3].id, :weight => 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment