mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Merge branch 'final_questions' of https://github.com/differentreality/osem into differentreality-final_questions
Conflicts: app/models/conference.rb config/routes.rb
This commit is contained in:
commit
243ea41456
28 changed files with 342 additions and 16 deletions
12
db/migrate/20140109190643_create_questions.rb
Normal file
12
db/migrate/20140109190643_create_questions.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
class CreateQuestions < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :questions do |t|
|
||||
t.string :title
|
||||
t.references :question_type
|
||||
t.integer :conference_id
|
||||
t.boolean :global
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
9
db/migrate/20140109190844_create_question_types.rb
Normal file
9
db/migrate/20140109190844_create_question_types.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
class CreateQuestionTypes < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :question_types do |t|
|
||||
t.string :title
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
9
db/migrate/20140109191042_create_answers.rb
Normal file
9
db/migrate/20140109191042_create_answers.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
class CreateAnswers < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :answers do |t|
|
||||
t.string :title
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
8
db/migrate/20140109191145_create_qanswers.rb
Normal file
8
db/migrate/20140109191145_create_qanswers.rb
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
class CreateQanswers < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :qanswers do |t|
|
||||
t.references :question
|
||||
t.references :answer
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
class CreateConferencesQuestions < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :conferences_questions, :id => false do |t|
|
||||
t.references :conference
|
||||
t.references :question
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
class CreateQanswersRegistrations < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :qanswers_registrations, :id => false do |t|
|
||||
t.references :registration, :null => false
|
||||
t.references :qanswer, :null => false
|
||||
end
|
||||
end
|
||||
end
|
||||
16
db/seeds.rb
16
db/seeds.rb
|
|
@ -8,3 +8,19 @@
|
|||
Role.create(:name => "Participant")
|
||||
Role.create(:name => "Organizer")
|
||||
Role.create(:name => "Admin")
|
||||
|
||||
qtype_yesno = QuestionType.create(:title => "Yes/No")
|
||||
qtype_single = QuestionType.create(:title => "Single Choice")
|
||||
qtype_multiple = QuestionType.create(:title => "Multiple Choice")
|
||||
|
||||
answer_yes = Answer.create(:title => "Yes")
|
||||
answer_no = Answer.create(:title => "No")
|
||||
|
||||
questions_yes_no = ["Do you need handicapped access to the venue?", "Are you attending with partner?", "Will you attend the social event(s)?", "Will you stay at suggested hotel?"]
|
||||
|
||||
for i in questions_yes_no do
|
||||
q = Question.create(:title => i, :question_type_id => qtype_yesno.id, :global => true)
|
||||
|
||||
Qanswer.create(:question_id => q.id, :answer_id => answer_no.id)
|
||||
Qanswer.create(:question_id => q.id, :answer_id => answer_yes.id)
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue