diff --git a/db/seeds.rb b/db/seeds.rb index 3987a81..ad0fce5 100755 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -77,7 +77,7 @@ }, { title: "Date", - option_based: true, + option_based: false, formattype: 6 } ] @@ -674,31 +674,6 @@ question_format: text_area, modifiable: false, themes: [Theme.find_by(title: "Storage & Security"), Theme.find_by(title: 'Data Format')]}, - {text: "Please select the appropriate formats.", - number: 2, - section: Section.find_by(title: "Data Format and Storage"), - question_format: QuestionFormat.find_by(title: "Radio buttons"), - modifiable: false, - themes: [Theme.find_by(title: "Storage & Security"), Theme.find_by(title: 'Data Format')]}, - {text: "Will software accompany your dataset?", - number: 1, - section: Section.find_by(title: "Collection Process"), - question_format: QuestionFormat.find_by(title: "Check box"), - modifiable: false, - themes: [Theme.find_by(title: "Data Collection")]}, - {text: "Where will you store your data during the research period?", - number: 2, - section: Section.find_by(title: "Collection Process"), - question_format: QuestionFormat.find_by(title: "Dropdown"), - modifiable: false, - themes: [Theme.find_by(title: "Data Collection")]}, - {text: "What type(s) of data will you collect?", - number: 3, - section: Section.find_by(title: "Collection Process"), - question_format: QuestionFormat.find_by(title: "Multi select box"), - option_comment_display: true, - modifiable: false, - themes: [Theme.find_by(title: "Data Collection")]}, {text: "What are your institution's ethical policies?", number: 1, section: Section.find_by(title: "Ethical Standards"), @@ -720,9 +695,106 @@ ] questions.map{ |q| create(:question, q) } -drop_down_question = Question.find_by(text: "Where will you store your data during the research period?") -multi_select_question = Question.find_by(text: "What type(s) of data will you collect?") -radio_button_question = Question.find_by(text: "Please select the appropriate formats.") +radio_button = Question.new( + text: "Please select the appropriate formats.", + number: 2, + section: Section.find_by(title: "Data Format and Storage"), + question_format: QuestionFormat.find_by(title: "Radio buttons"), + modifiable: false, + themes: [Theme.find_by(title: "Storage & Security"), Theme.find_by(title: 'Data Format')]) +radio_button.question_options.build([ + { + text: "csv files", + number: 1, + is_default: false + }, + { + text: "database (e.g. mysql, redis)", + number: 2, + is_default: false + }, + { + text: "archive files (e.g. tar, zip)", + number: 3, + is_default: false + }]) +radio_button.save! + +checkbox = Question.new( + text: "Will software accompany your dataset?", + number: 1, + section: Section.find_by(title: "Collection Process"), + question_format: QuestionFormat.find_by(title: "Check box"), + modifiable: false, + themes: [Theme.find_by(title: "Data Collection")]) +checkbox.question_options.build([ + { + text: "local hard drive", + number: 1, + is_default: true + }, + { + text: "personal cloud storage", + number: 2, + is_default: false + }, + { + text: "institutional servers", + number: 3, + is_default: false + }]) +checkbox.save! + +dropdown = Question.new( + text: "Where will you store your data during the research period?", + number: 2, + section: Section.find_by(title: "Collection Process"), + question_format: QuestionFormat.find_by(title: "Dropdown"), + modifiable: false, + themes: [Theme.find_by(title: "Data Collection")]) +dropdown.question_options.build([ + { + text: "In a database", + number: 1, + is_default: false + }, + { + text: "In a pendrive", + number: 2, + is_default: false + }]) +dropdown.save! + +multi_select_box = Question.new( + text: "What type(s) of data will you collect?", + number: 3, + section: Section.find_by(title: "Collection Process"), + question_format: QuestionFormat.find_by(title: "Multi select box"), + option_comment_display: true, + modifiable: false, + themes: [Theme.find_by(title: "Data Collection")]) +multi_select_box.question_options.build([ + { + text: "statistical", + number: 1, + is_default: false + }, + { + text: "image/video", + number: 2, + is_default: false + }, + { + text: "geographical", + number: 3, + is_default: false + }, + { + text: "other", + number: 4, + is_default: false + }]) +multi_select_box.save! # Create suggested answers for a few questions # ------------------------------------------------------- @@ -737,51 +809,3 @@ question: Question.find_by(text: "What types of data will you collect and how will it be stored?")}, ] annotations.map{ |s| Annotation.create!(s) if Annotation.find_by(text: s[:text]).nil? } - -# Create options for the dropdown, multi-select and radio buttons -# ------------------------------------------------------- -question_options = [ - {text: "csv files", - number: 1, - question: radio_button_question, - is_default: false}, - {text: "database (e.g. mysql, redis)", - number: 2, - question: radio_button_question, - is_default: false}, - {text: "archive files (e.g. tar, zip)", - number: 3, - question: radio_button_question, - is_default: false}, - - {text: "local hard drive", - number: 1, - question: drop_down_question, - is_default: true}, - {text: "personal cloud storage", - number: 2, - question: drop_down_question, - is_default: false}, - {text: "institutional servers", - number: 3, - question: drop_down_question, - is_default: false}, - - {text: "statistical", - number: 1, - question: multi_select_question, - is_default: false}, - {text: "image/video", - number: 2, - question: multi_select_question, - is_default: false}, - {text: "geographical", - number: 3, - question: multi_select_question, - is_default: false}, - {text: "other", - number: 4, - question: multi_select_question, - is_default: false} -] -question_options.map{ |q| QuestionOption.create!(q) if QuestionOption.find_by(text: q[:text]).nil? }