implications: count 'queued' implications as active.
Bug: implications that were approved but that were still in the 'queued' state were not seen as active yet, which led to the transitivity validation passing because it didn't include queued implications.
This commit is contained in:
@@ -32,7 +32,7 @@ class TagImplication < ApplicationRecord
|
|||||||
module ClassMethods
|
module ClassMethods
|
||||||
# assumes names are normalized
|
# assumes names are normalized
|
||||||
def with_descendants(names)
|
def with_descendants(names)
|
||||||
(names + where("antecedent_name in (?) and status in (?)", names, ["active", "processing"]).map(&:descendant_names_array)).flatten.uniq
|
(names + active.where(antecedent_name: names).flat_map(&:descendant_names_array)).uniq
|
||||||
end
|
end
|
||||||
|
|
||||||
def automatic_tags_for(names)
|
def automatic_tags_for(names)
|
||||||
@@ -49,7 +49,7 @@ class TagImplication < ApplicationRecord
|
|||||||
|
|
||||||
until children.empty?
|
until children.empty?
|
||||||
all.concat(children)
|
all.concat(children)
|
||||||
children = TagImplication.where("antecedent_name IN (?) and status in (?)", children, ["active", "processing"]).map(&:consequent_name)
|
children = TagImplication.active.where(antecedent_name: children).pluck(:consequent_name)
|
||||||
end
|
end
|
||||||
end.sort.uniq
|
end.sort.uniq
|
||||||
end
|
end
|
||||||
@@ -97,7 +97,7 @@ class TagImplication < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def active
|
def active
|
||||||
where("status IN (?)", ["active", "processing"])
|
where(status: %w[active processing queued])
|
||||||
end
|
end
|
||||||
|
|
||||||
def search(params)
|
def search(params)
|
||||||
|
|||||||
Reference in New Issue
Block a user