ai tags: add ability to order /ai_tags page by confidence.
This commit is contained in:
@@ -20,7 +20,19 @@ class AITag < ApplicationRecord
|
|||||||
q = q.where.missing(:post)
|
q = q.where.missing(:post)
|
||||||
end
|
end
|
||||||
|
|
||||||
q = q.apply_default_order(params)
|
case params[:order]
|
||||||
|
when "score", "score_desc"
|
||||||
|
q = q.order(score: :desc, media_asset_id: :desc, tag_id: :desc)
|
||||||
|
when "score_asc"
|
||||||
|
q = q.order(score: :asc, media_asset_id: :asc, tag_id: :asc)
|
||||||
|
when "media_asset_id", "media_asset_id_desc"
|
||||||
|
q = q.order(media_asset_id: :desc, tag_id: :desc)
|
||||||
|
when "media_asset_id_asc"
|
||||||
|
q = q.order(media_asset_id: :asc, tag_id: :asc)
|
||||||
|
else
|
||||||
|
q = q.apply_default_order(params)
|
||||||
|
end
|
||||||
|
|
||||||
q
|
q
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<%= f.input :post_tags_match, label: "Post Search", input_html: { value: params.dig(:search, :post_tags_match), data: { autocomplete: "tag-query" } } %>
|
<%= f.input :post_tags_match, label: "Post Search", input_html: { value: params.dig(:search, :post_tags_match), data: { autocomplete: "tag-query" } } %>
|
||||||
<%= f.input :score, label: "Confidence", input_html: { value: params.dig(:search, :score) } %>
|
<%= f.input :score, label: "Confidence", input_html: { value: params.dig(:search, :score) } %>
|
||||||
<%= f.input :is_posted, as: :hidden, input_html: { value: params.dig(:search, :is_posted) } %>
|
<%= f.input :is_posted, as: :hidden, input_html: { value: params.dig(:search, :is_posted) } %>
|
||||||
|
<%= f.input :order, collection: [%w[Newest media_asset_id], %w[Oldest media_asset_id_asc], %w[Confidence score_desc]], include_blank: true, selected: params[:search][:order] %>
|
||||||
<%= f.submit "Search" %>
|
<%= f.submit "Search" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user