diff --git a/app/jobs/snpedia.rb b/app/jobs/snpedia.rb index 736d620..39739df 100644 --- a/app/jobs/snpedia.rb +++ b/app/jobs/snpedia.rb @@ -9,6 +9,14 @@ class Snpedia def self.perform(snp_id) @snp = Snp.find(snp_id) + # get the marshalled array + File.open("#{Rails.root}/marshalled_snpedia_array", "r") do |file| + namearray = Marshal.load(file) + end + + if !namearray.include?(@snp.name) + puts @snp.name + " not included in the array" + else if @snp.snpedia_updated < 31.days.ago mw = MediaWiki::Gateway.new("http://www.snpedia.com/api.php") # return an array of page-titles @@ -60,5 +68,6 @@ class Snpedia else print "snpedia: time threshold not met\n" end + end end end diff --git a/db/schema.rb b/db/schema.rb index 6dc1460..9c5d3b2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -130,9 +130,9 @@ ActiveRecord::Schema.define(:version => 20111028212506) do t.string "allele_frequency" t.integer "ranking" t.integer "number_of_users", :default => 0 - t.datetime "mendeley_updated", :default => '2011-08-24 03:44:32' - t.datetime "plos_updated", :default => '2011-08-24 03:44:32' - t.datetime "snpedia_updated", :default => '2011-08-24 03:44:32' + t.datetime "mendeley_updated", :default => '2011-08-27 16:54:19' + t.datetime "plos_updated", :default => '2011-08-27 16:54:19' + t.datetime "snpedia_updated", :default => '2011-08-27 16:54:19' t.datetime "created_at" t.datetime "updated_at" t.string "slug" diff --git a/marshalled_snpedia_array b/marshalled_snpedia_array new file mode 100644 index 0000000..1e548d4 Binary files /dev/null and b/marshalled_snpedia_array differ