Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 9943b4d1fc
Fetching contributors…

Cannot retrieve contributors at this time

44 lines (33 sloc) 0.879 kb
class ImportTopickeys
@queue = :innoviz
def self.perform
Topickey.import_topics
end
end
class Topickey
include Mongoid::Document
field :topic_id, type: Integer
field :urlkey, type: String
field :name, type: String
field :freq, type: Integer
index({topic_id: 1},{unique: true})
def self.import_topics
a=Member.summarize_topics
a.map{|k,v| Topickey.create(:topic_id=>k.map{|c,n| c}[0],:name=>k.map{|c,n| n}[0].unpack("C*").pack("U*"),:freq=>v)}
end
def self.android
all.find_all { |t| t.name =~ /(android)/i }
end
def self.ios
all.find_all { |t| t.name =~ /\b(iphone|ios|ipad|mac)\b/i }
end
def self.blackberry
all.find_all { |t| t.name =~ /(blackberry)/i }
end
def self.windows
all.find_all { |t| t.name =~ /\b(win|windows)\b/i }
end
def self.async_import
Resque.enqueue(ImportTopickeys)
end
end
Jump to Line
Something went wrong with that request. Please try again.