removed other sidekiq stuff.
This commit is contained in:
parent
951bd8d4a5
commit
7182996134
2 changed files with 0 additions and 23 deletions
|
@ -8,8 +8,6 @@ class Map < ActiveRecord::Base
|
||||||
has_many :topics, :through => :topicmappings
|
has_many :topics, :through => :topicmappings
|
||||||
has_many :synapses, :through => :synapsemappings
|
has_many :synapses, :through => :synapsemappings
|
||||||
|
|
||||||
#after_touch :save_screenshot
|
|
||||||
|
|
||||||
# This method associates the attribute ":image" with a file attachment
|
# This method associates the attribute ":image" with a file attachment
|
||||||
has_attached_file :screenshot, :styles => {
|
has_attached_file :screenshot, :styles => {
|
||||||
:thumb => ['188x126#', :png]
|
:thumb => ['188x126#', :png]
|
||||||
|
@ -121,17 +119,6 @@ class Map < ActiveRecord::Base
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
def save_screenshot
|
|
||||||
# TODO - this will grab a map every single frickin' time a map is touched
|
|
||||||
# we need a system to throttle the amount to 1/hour or something like that
|
|
||||||
# maybe have a flag - last time this map was screenshotted
|
|
||||||
# don't update if it was less than an hour ago
|
|
||||||
# except this has the issue of a user updating map 7x, and it only screenshotting after
|
|
||||||
# the first time. We only want it to screenhsot the 7th time.
|
|
||||||
# We need to store a timestamp somewhere and do processing every hour, I think.
|
|
||||||
GrabMapScreenshotWorker.perform_async(self.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def decode_base64(imgBase64)
|
def decode_base64(imgBase64)
|
||||||
decoded_data = Base64.decode64(imgBase64)
|
decoded_data = Base64.decode64(imgBase64)
|
||||||
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
# app/workers/grab_map_screenshot_worker.rb
|
|
||||||
class GrabMapScreenshotWorker
|
|
||||||
include Sidekiq::Worker
|
|
||||||
|
|
||||||
def perform(map_id)
|
|
||||||
imgBase64 = `phantomjs ./script/phantomjs-save-screenshot.js #{map_id} #{Rails.env}`
|
|
||||||
map = Map.find(map_id)
|
|
||||||
map.decode_base64(imgBase64)
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Add table
Reference in a new issue