mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 18:26:06 +02:00
story#115762063 - not always we have all the data in log_children table
This commit is contained in:
parent
f873b14214
commit
fb330ad87a
1 changed files with 2 additions and 2 deletions
|
@ -60,7 +60,7 @@ module Versions
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
def all_versions_for(ids, time)
|
def all_versions_for(ids, time)
|
||||||
ver_klass = paper_trail_version_class
|
ver_klass = paper_trail_version_class
|
||||||
from_history = ver_klass.where(item_id: ids).
|
from_history = ver_klass.where(item_id: ids.to_a).
|
||||||
order(:item_id).
|
order(:item_id).
|
||||||
preceding(time + 1, true).
|
preceding(time + 1, true).
|
||||||
select("distinct on (item_id) #{ver_klass.table_name}.*").
|
select("distinct on (item_id) #{ver_klass.table_name}.*").
|
||||||
|
@ -70,7 +70,7 @@ module Versions
|
||||||
ver.object_changes.to_h.each { |k, v| o[k]=v[-1] }
|
ver.object_changes.to_h.each { |k, v| o[k]=v[-1] }
|
||||||
o
|
o
|
||||||
end
|
end
|
||||||
not_in_history = where(id: (ids - from_history.map(&:id)))
|
not_in_history = where(id: (ids.to_a - from_history.map(&:id)))
|
||||||
|
|
||||||
from_history + not_in_history
|
from_history + not_in_history
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue