modify fake data
This commit is contained in:
parent
6de62318c5
commit
46576c6947
107
db/seeds.rb
107
db/seeds.rb
|
@ -25,62 +25,63 @@ FactoryGirl.define do
|
|||
f.sequence(:email) do |n| "#{email[n]}" end
|
||||
f.name_id BSON::ObjectId('4f45f3b9e9d02c5db9000067') #user_id, this is Chris' account
|
||||
end
|
||||
|
||||
factory :paper_record, class: "WritingJournal" do |f|
|
||||
f.sequence(:paper_title_translations) do |n|
|
||||
{ zh_tw: "tw_#{data_json[n]["paper_title"]}",
|
||||
en: "en_#{data_json[n]["paper_title"]}" }
|
||||
end
|
||||
|
||||
f.sequence(:journal_title_translations) do |n|
|
||||
{zh_tw: "tw_#{data_json[n]["booktitle"]}",
|
||||
en: "en_#{data_json[n]["booktitle"]}"}
|
||||
end
|
||||
|
||||
f.sequence(:abstract) do |n|
|
||||
"#{data_json[n]["abstract"]}"
|
||||
end
|
||||
|
||||
f.sequence(:isbn) do |n|
|
||||
"#{data_json[n]["isbn"]}"
|
||||
end
|
||||
|
||||
f.sequence(:year) do |n|
|
||||
"#{data_json[n]["year"]}"
|
||||
end
|
||||
|
||||
f.sequence(:authors) do |n|
|
||||
"#{data_json[n]["author"].map{|m| m.split(",").reverse.join(" ")}.join(",")}"
|
||||
end
|
||||
|
||||
f.sequence(:form_to_start) do |n|
|
||||
"#{data_json[n]["page_from"]}"
|
||||
end
|
||||
|
||||
f.sequence(:form_to_end) do |n|
|
||||
"#{data_json[n]["page_to"]}"
|
||||
end
|
||||
|
||||
f.sequence(:total_pages) do |n|
|
||||
"#{data_json[n]["total_page"]}"
|
||||
end
|
||||
|
||||
f.sequence(:language) do |n|
|
||||
"#{data_json[n]["language"]}"
|
||||
end
|
||||
|
||||
f.sequence(:keywords) do |n|
|
||||
"#{data_json[n]["abstract"].split[-3..-1].join(",")}"
|
||||
end
|
||||
|
||||
f.create_user_id BSON::ObjectId('4f45f3b9e9d02c5db9000067') #user_id, this is Chris' account
|
||||
f.update_user_id BSON::ObjectId('4f45f3b9e9d02c5db9000067') #user_id, this is Chris' account
|
||||
end
|
||||
end
|
||||
# factory :paper_record, class: "WritingJournal" do |f|
|
||||
# f.sequence(:paper_title_translations) do |n|
|
||||
# { zh_tw: "tw_#{data_json[n]["paper_title"]}",
|
||||
# en: "en_#{data_json[n]["paper_title"]}" }
|
||||
# end
|
||||
#
|
||||
# f.sequence(:journal_title_translations) do |n|
|
||||
# {zh_tw: "tw_#{data_json[n]["booktitle"]}",
|
||||
# en: "en_#{data_json[n]["booktitle"]}"}
|
||||
# end
|
||||
#
|
||||
# f.sequence(:abstract) do |n|
|
||||
# "#{data_json[n]["abstract"]}"
|
||||
# end
|
||||
#
|
||||
# f.sequence(:isbn) do |n|
|
||||
# "#{data_json[n]["isbn"]}"
|
||||
# end
|
||||
#
|
||||
# f.sequence(:year) do |n|
|
||||
# "#{data_json[n]["year"]}"
|
||||
# end
|
||||
#
|
||||
# f.sequence(:authors) do |n|
|
||||
# "#{data_json[n]["author"].map{|m| m.split(",").reverse.join(" ")}.join(",")}"
|
||||
# end
|
||||
#
|
||||
# f.sequence(:form_to_start) do |n|
|
||||
# "#{data_json[n]["page_from"]}"
|
||||
# end
|
||||
#
|
||||
# f.sequence(:form_to_end) do |n|
|
||||
# "#{data_json[n]["page_to"]}"
|
||||
# end
|
||||
#
|
||||
# f.sequence(:total_pages) do |n|
|
||||
# "#{data_json[n]["total_page"]}"
|
||||
# end
|
||||
#
|
||||
# f.sequence(:language) do |n|
|
||||
# "#{data_json[n]["language"]}"
|
||||
# end
|
||||
#
|
||||
# f.sequence(:keywords) do |n|
|
||||
# "#{data_json[n]["abstract"].split[-3..-1].join(",")}"
|
||||
# end
|
||||
#
|
||||
# f.create_user_id BSON::ObjectId('4f45f3b9e9d02c5db9000067') #user_id, this is Chris' account
|
||||
# f.update_user_id BSON::ObjectId('4f45f3b9e9d02c5db9000067') #user_id, this is Chris' account
|
||||
# end
|
||||
|
||||
|
||||
#50.times.each do
|
||||
# FactoryGirl.create(:paper_record)
|
||||
#end
|
||||
50.times.each do
|
||||
FactoryGirl.create(:paper_record)
|
||||
end
|
||||
|
||||
50.times.each do
|
||||
FactoryGirl.create(:co_author_candidate)
|
||||
|
|
Loading…
Reference in New Issue