Fix and implement supplier counters
This commit is contained in:
@@ -6,6 +6,7 @@ module Qwaiter
|
||||
autoload :Serializer
|
||||
autoload :Counter
|
||||
autoload :Broadcaster
|
||||
autoload :Couchbase
|
||||
|
||||
def self.broadcast_user(uid, event, data)
|
||||
message = {channel: "/user/#{uid}", data: {event: event, data: data}}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
module Qwaiter
|
||||
module Couchbase
|
||||
def self.connection
|
||||
$cb
|
||||
end
|
||||
|
||||
def self.load_design_docs!
|
||||
Dir.glob(Rails.root.join('config/couchbase/design_docs', "*.json")).each do |design_doc|
|
||||
connection.save_design_doc File.open(design_doc)
|
||||
end
|
||||
end
|
||||
|
||||
def self.design_doc(name)
|
||||
connection.design_docs[name]
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -8,15 +8,16 @@ module Qwaiter
|
||||
end
|
||||
|
||||
def self.get(key)
|
||||
connection.get(key).to_i
|
||||
connection.get(key, quiet: true).to_i
|
||||
end
|
||||
|
||||
def self.incr(*args)
|
||||
connection.incr(*args)
|
||||
def self.incr(key, options = {})
|
||||
options[:initial] ||= 0
|
||||
connection.incr(key, options)
|
||||
end
|
||||
|
||||
def self.decr(*args)
|
||||
connection.decr(*args)
|
||||
def self.decr(key, options = {})
|
||||
connection.decr(key, options)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,7 +16,7 @@ module RQRCode
|
||||
|
||||
qrcode = RQRCode::QRCode.new(string, :size => size, :level => level)
|
||||
svg = RQRCode::Renderers::SVG::render(qrcode, options)
|
||||
|
||||
|
||||
data = \
|
||||
if format == :png
|
||||
image = MiniMagick::Image.read(svg) { |i| i.format "svg" }
|
||||
|
||||
Reference in New Issue
Block a user