Skip to content
Snippets Groups Projects
Commit 620641d0 authored by Mateus Rambo Strey's avatar Mateus Rambo Strey
Browse files

fix builders

parent c56a35d5
No related branches found
No related tags found
No related merge requests found
......@@ -8,8 +8,8 @@ class Builder
objects.each do |object|
next if object[id].blank?
if cache
o = Rails.cache.fetch(cache_key(object[id], object[last_modified])) unless object[last_modified].blank?
if cache && !object[last_modified].blank?
o = Rails.cache.fetch(cache_key(object[id], object[last_modified]))
end
o = repository.find object[id] if o.nil?
......@@ -18,16 +18,12 @@ class Builder
array
end
def self.build_from_orientdb(args = {}, cache = true)
def self.build_from_orientdb(args = {})
object = nil
unless args.nil? || !block_given?
# cache object when build
if cache
object = Rails.cache.fetch(cache_key(args['@rid'], args['last_modified']), expires_in: 12.hours) { yield }
else
object = yield
end
object = Rails.cache.fetch(cache_key(args['@rid'], args['last_modified']), expires_in: 12.hours) { yield }
end
object
......
......@@ -9,7 +9,7 @@ class ComplaintBuilder < Builder
end
def self.build_from_orientdb(args = {})
super(args, false) do
unless args.blank?
created = DateTime.now.strftime("%Y-%m-%d %H:%M:%S")
created = DateTime.strptime(args['created_at'], "%Y-%m-%d %H:%M:%S") unless args['created_at'].blank?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment