aliases/implications: fix retired aliases being sorted first on index page.

This commit is contained in:
evazion
2018-12-31 17:07:14 -06:00
parent d393d67a9b
commit aceded710a

View File

@@ -80,7 +80,8 @@ class TagRelationship < ApplicationRecord
end
def pending_first
order(Arel.sql("(case status when 'pending' then 1 when 'queued' then 2 when 'active' then 3 else 0 end), antecedent_name, consequent_name"))
# unknown statuses return null and are sorted first
order(Arel.sql("array_position(array['queued', 'processing', 'pending', 'active', 'deleted', 'retired'], status) NULLS FIRST, antecedent_name, consequent_name"))
end
def active