|
|
|
@ -8,33 +8,49 @@ |
|
|
|
|
|
|
|
|
|
|
|
if Rails.env.development? |
|
|
|
if Rails.env.development? |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
subjects = [ |
|
|
|
|
|
|
|
"Civil Law", |
|
|
|
|
|
|
|
"Commercial Law (or Mercantile Law)", |
|
|
|
|
|
|
|
"Labor Law", |
|
|
|
|
|
|
|
"Legal and Judicial Ethics", |
|
|
|
|
|
|
|
"Remedial Law", |
|
|
|
|
|
|
|
"Taxation Law", |
|
|
|
|
|
|
|
"Political Law", |
|
|
|
|
|
|
|
"Criminal Law" |
|
|
|
|
|
|
|
].freeze |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
subjects.each { |name| Cdao::Subject.create(name: name, ancestry: nil) } if Cdao::Subject.count.zero? |
|
|
|
|
|
|
|
|
|
|
|
annomarks = { |
|
|
|
annomarks = { |
|
|
|
"A" => "Affirmed", |
|
|
|
"A" => "Affirmed", |
|
|
|
"C" => "Cited", |
|
|
|
"C" => "Cited", |
|
|
|
"D" => "Distinguished", |
|
|
|
"D" => "Distinguished", |
|
|
|
"F" => "Footnote", |
|
|
|
"F" => "Footnote", |
|
|
|
"I" => "Illustrative", |
|
|
|
"I" => "Illustrative", |
|
|
|
"M" => "Modified", |
|
|
|
"M" => "Modified", |
|
|
|
"O" => "Overruled", |
|
|
|
"O" => "Overruled", |
|
|
|
"CO" => "Concurring Opinion", |
|
|
|
"CO" => "Concurring Opinion", |
|
|
|
"SO" => "Seperated Opinion" |
|
|
|
"SO" => "Seperated Opinion" |
|
|
|
} |
|
|
|
}.freeze |
|
|
|
|
|
|
|
|
|
|
|
annomarks.each { |k, v| Annomark.create(name: v, code: k) } if Annomark.count.zero? |
|
|
|
annomarks.each { |k, v| Annomark.create(name: v, code: k) } if Annomark.count.zero? |
|
|
|
|
|
|
|
|
|
|
|
Doctrine.destroy_all |
|
|
|
Doctrine.destroy_all |
|
|
|
|
|
|
|
Annotation.destroy_all |
|
|
|
doctrine = Doctrine.new |
|
|
|
|
|
|
|
doctrine.document = Cdao::Jurisprudence.first |
|
|
|
Cdao::Subject.find_each.with_index do |subject, index| |
|
|
|
doctrine.content = "Dasdsadsadsa" |
|
|
|
doctrine = Doctrine.new |
|
|
|
doctrine.save |
|
|
|
doctrine.document = Cdao::Jurisprudence.first(index + 1).last |
|
|
|
doctrine.subject_ids = Cdao::Subject.first(3).map(&:id) |
|
|
|
doctrine.content = Faker::Lorem.paragraph |
|
|
|
|
|
|
|
doctrine.save |
|
|
|
doctrine = Doctrine.first |
|
|
|
doctrine.subject_ids = [subject.id] |
|
|
|
annotation = doctrine.annotations.new |
|
|
|
|
|
|
|
annotation.document = Cdao::Jurisprudence.second |
|
|
|
annotation = doctrine.annotations.new |
|
|
|
annotation.annomark = Annomark.first |
|
|
|
annotation.document = Cdao::Jurisprudence.last(index + 1).first |
|
|
|
annotation.save |
|
|
|
annotation.annomark_ids = [Faker::Number.between(from: Annomark.first.id, to: Annomark.last.id)] |
|
|
|
|
|
|
|
annotation.save |
|
|
|
|
|
|
|
|
|
|
|
end |
|
|
|
annotation_document = annotation.annotation_documents.new |
|
|
|
|
|
|
|
annotation_document.document = Cdao::Jurisprudence.last(index + 101).first |
|
|
|
|
|
|
|
annotation_document.save |
|
|
|
|
|
|
|
end |
|
|
|
|