Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed desiner problem #330

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
334 changes: 168 additions & 166 deletions Rails/WebsitesPrototypeBuilder/db/seeds.rb
Original file line number Diff line number Diff line change
@@ -1,213 +1,215 @@
# Answers
(0..10).each do |i|
Answer.create(answer: "answer#{i}", question_id: (i%3), page_id: (i%3));
end

# cards
(0..10).each do |i|
Card.create(title: "card#{i}", description: "description#{i}",
cardsort_id: (i%3));
end

# groups
(0..10).each do |i|
Group.create(title: "group#{i}", description: "description#{i}",
cardsort_id: (i%3));
end

#cards_groups
(0..10).each do |i|
Card.find(rand(1..5)).groups << Group.find(rand(1..5))
end

# cardsorts
(0..10).each do |i|
Cardsort.create(title: "cardsort#{i}", description: "description#{i}",
project_id: (i%3));
end

# choices
(0..10).each do |i|
Choice.create(body: "choice#{i}", qquestion_id: (i%3))
end

#cardsortresults
(0..10).each do |i|
CardsortResult.create(cardsort_id: (i%3),
reviewer_id: (i%3),
group_id: (i%3),
card_id: (i%3))
end

# comments
(0..10).each do |i|
Comment.create(page_id: (i%3), reviewer: (i%3),
assigned_part: "element#{i}", body: "comment#{i}")
end

# Reviewer
(0..10).each do |i|
Reviewer.create(email: "email#{i}@gmail.com")
end

# Step_answers
(0..10).each do |i|
StepAnswer.create(successful: true,
reviewer_id: (i%3),
task_result_id: (i%3),
step_id: (i%3))
end


# Step
(0..10).each do |i|
Step.create(component: "element#{i}",
event: "onclick", description:"description#{i}",
task_id: (i%3), page_id: (i%3))
end

# pages
(0..10).each do |i|
Page.create(page_name: "page#{i}",
html: "<input>",
project_id: (i%3))
end

# projects
(0..10).each do |i|
Project.create(project_name: "project#{i}", project_type: "type{i}",
description: "description#{i}",
designer_id: (i%3))
end

# Questionaire with Qquestions and choices where necessary
(0..10).each do |i|
Questionnaire.create(project_id: (i%3),
title: "questionaire#{i}",
qquestions_attributes: [{body: "Question A", qtype: 1},
{body: "Question B", qtype: 2},
{body: "Question C", qtype: 3,
choices_attributes: [body: "Choice A"]},
{body: "Question D", qtype: 4,
choices_attributes: [{body: "Choice A"},
{body: "Choice B"}, {body: "Choice C"}]}])
end

# Reviewer_infos
(0..10).each do |i|
ReviewerInfo.create(name: "reviewer#{i}",
age: rand(0..18),
gender: true,
country: ('a'..'z').to_a.shuffle[0,20],
day_of_birth: rand(0..30),
month_of_birth: rand(0..12),
year_of_birth: rand(0..2013),
reviewer_id: rand(0..5))
end

# Reviewer
(0..10).each do |i|
Reviewer.create(email: "email#{i}@gmail.com")
end

# Step_answers
(0..10).each do |i|
StepAnswer.create(successful: true,
reviewer_id: (i%3),
task_result_id: (i%3),
step_id: (i%3))
end

# Step
(0..10).each do |i|
Step.create(component: "element#{i}",
event: "onclick",
description: "description#{i}",
task_id: (i%3))
end

# Task_result
(0..10).each do |i|
TaskResult.create(task_id: (i%3),
reviewer_id: (i%3),
clicks: (i%3),
success: ((i%3) == 0),
time: (i%3))
end

# Task
(0..10).each do |i|
Task.create(name: "task#{i}",
description: "description#{i}",
project_id: (i%3),
page_id: (i%3),
time_limit: (i%3))
end
# # Answers
# (0..10).each do |i|
# Answer.create(answer: "answer#{i}", question_id: (i%3), page_id: (i%3));
# end

# # cards
# (0..10).each do |i|
# Card.create(title: "card#{i}", description: "description#{i}",
# cardsort_id: (i%3));
# end

# # groups
# (0..10).each do |i|
# Group.create(title: "group#{i}", description: "description#{i}",
# cardsort_id: (i%3));
# end

# #cards_groups
# (0..10).each do |i|
# Card.find(rand(1..5)).groups << Group.find(rand(1..5))
# end

# # cardsorts
# (0..10).each do |i|
# Cardsort.create(title: "cardsort#{i}", description: "description#{i}",
# project_id: (i%3));
# end

# # choices
# (0..10).each do |i|
# Choice.create(body: "choice#{i}", qquestion_id: (i%3))
# end

# #cardsortresults
# (0..10).each do |i|
# CardsortResult.create(cardsort_id: (i%3),
# reviewer_id: (i%3),
# group_id: (i%3),
# card_id: (i%3))
# end

# # comments
# (0..10).each do |i|
# Comment.create(page_id: (i%3), reviewer: (i%3),
# assigned_part: "element#{i}", body: "comment#{i}")
# end

# # Reviewer
# (0..10).each do |i|
# Reviewer.create(email: "email#{i}@gmail.com")
# end

# # Step_answers
# (0..10).each do |i|
# StepAnswer.create(successful: true,
# reviewer_id: (i%3),
# task_result_id: (i%3),
# step_id: (i%3))
# end


# # Step
# (0..10).each do |i|
# Step.create(component: "element#{i}",
# event: "onclick", description:"description#{i}",
# task_id: (i%3), page_id: (i%3))
# end

# # pages
# (0..10).each do |i|
# Page.create(page_name: "page#{i}",
# html: "<input>",
# project_id: (i%3))
# end

# # projects
# (0..10).each do |i|
# Project.create(project_name: "project#{i}", project_type: "type{i}",
# description: "description#{i}",
# designer_id: (i%3))
# end

# # Questionaire with Qquestions and choices where necessary
# (0..10).each do |i|
# Questionnaire.create(project_id: (i%3),
# title: "questionaire#{i}",
# qquestions_attributes: [{body: "Question A", qtype: 1},
# {body: "Question B", qtype: 2},
# {body: "Question C", qtype: 3,
# choices_attributes: [body: "Choice A"]},
# {body: "Question D", qtype: 4,
# choices_attributes: [{body: "Choice A"},
# {body: "Choice B"}, {body: "Choice C"}]}])
# end

# # Reviewer_infos
# (0..10).each do |i|
# ReviewerInfo.create(name: "reviewer#{i}",
# age: rand(0..18),
# gender: true,
# country: ('a'..'z').to_a.shuffle[0,20],
# day_of_birth: rand(0..30),
# month_of_birth: rand(0..12),
# year_of_birth: rand(0..2013),
# reviewer_id: rand(0..5))
# end

# # Reviewer
# (0..10).each do |i|
# Reviewer.create(email: "email#{i}@gmail.com")
# end

# # Step_answers
# (0..10).each do |i|
# StepAnswer.create(successful: true,
# reviewer_id: (i%3),
# task_result_id: (i%3),
# step_id: (i%3))
# end

# # Step
# (0..10).each do |i|
# Step.create(component: "element#{i}",
# event: "onclick",
# description: "description#{i}",
# task_id: (i%3))
# end

# # Task_result
# (0..10).each do |i|
# TaskResult.create(task_id: (i%3),
# reviewer_id: (i%3),
# clicks: (i%3),
# success: ((i%3) == 0),
# time: (i%3))
# end

# # Task
# (0..10).each do |i|
# Task.create(name: "task#{i}",
# description: "description#{i}",
# project_id: (i%3),
# page_id: (i%3),
# time_limit: (i%3))
# end

# Designers
Designer.create(:fullname => "Test Designer0",
@d = Designer.new(:fullname => "Test Designer0",
:email => "[email protected]",
:password => "pass1234",
:password_confirmation => "pass1234",
:phone_number => "01004509771",
:country => "Egypt",
:day_dob => 15,
:month_dob => 10,
:year_dob => 1990,
:credit_card_number => 1234567891234567,
:cvv2 => 123)
Designer.create(:fullname => "Test Designer1",
:year_dob => 1990)
@d.confirmed_at = Time.now
@d.save

@d = Designer.create(:fullname => "Test Designer1",
:email => "[email protected]",
:password => "pass1234",
:password_confirmation => "pass1234",
:phone_number => "01004509771",
:country => "Egypt",
:day_dob => 15,
:month_dob => 10,
:year_dob => 1990,
:credit_card_number => 1234567891234567,
:cvv2 => 123)
:year_dob => 1990)
@d.confirmed_at = Time.now
@d.save

Designer.create(:fullname => "Test Designer2",
@d = Designer.create(:fullname => "Test Designer2",
:email => "[email protected]",
:password => "pass1234",
:password_confirmation => "pass1234",
:phone_number => "01004509771",
:country => "Egypt",
:day_dob => 15,
:month_dob => 10,
:year_dob => 1990,
:credit_card_number => 1234567891234567,
:cvv2 => 123)
:year_dob => 1990)
@d.confirmed_at = Time.now
@d.save

Designer.create(:fullname => "Test Designer3",
@d = Designer.create(:fullname => "Test Designer3",
:email => "[email protected]",
:password => "pass1234",
:password_confirmation => "pass1234",
:phone_number => "01004509771",
:country => "Egypt",
:day_dob => 15,
:month_dob => 10,
:year_dob => 1990,
:credit_card_number => 1234567891234567,
:cvv2 => 123)
:year_dob => 1990)
@d.confirmed_at = Time.now
@d.save

Designer.create(:fullname => "Test Designer4",
@d = Designer.create(:fullname => "Test Designer4",
:email => "[email protected]",
:password => "pass1234",
:password_confirmation => "pass1234",
:phone_number => "01004509771",
:country => "Egypt",
:day_dob => 15,
:month_dob => 10,
:year_dob => 1990,
:credit_card_number => 1234567891234567,
:cvv2 => 123)
:year_dob => 1990)
@d.confirmed_at = Time.now
@d.save

# Reviewer_Task
(0..10).each do |i|
Reviewer.find((i%3)+1).tasks << Task.find((i%3)+1)
end

(0..10).each do |i|
Cardsort.find((i%3)+1).reviewers << Reviewer.find((i%3)+1)
Cardsort.find((i%3)+1).reviewers << Reviewer.find((i%3)+1)
end