Add "Support summary" section to Rainbow Pool

This both gives us a sense of progress on labeling, and adds a link to
get started in bulk labeling mode!
This commit is contained in:
Emi Matchu 2024-12-01 11:13:21 -08:00
parent 0d2648d030
commit ab238ab2a6
4 changed files with 35 additions and 6 deletions

View file

@ -35,10 +35,7 @@ class PetStatesController < ApplicationController
end
def next_unlabeled_appearance_path
# Rather than just getting the newest unlabeled pet state, prioritize the
# newest *pet type*. This better matches the user's perception of what the
# newest state is, because the Rainbow Pool UI is grouped by pet type!
unlabeled_appearance = PetState.needs_labeling.newest_pet_type.newest.first
unlabeled_appearance = PetState.next_unlabeled_appearance
if unlabeled_appearance
edit_pet_type_pet_state_path(

View file

@ -35,6 +35,16 @@ class PetTypesController < ApplicationController
if @selected_species && @selected_color && @pet_types.size == 1
redirect_to @pet_types.first
end
if support_staff?
@counts = {
total: PetState.count,
glitched: PetState.glitched.count,
needs_labeling: PetState.needs_labeling.count,
usable: PetState.usable.count,
}
@unlabeled_appearance = PetState.next_unlabeled_appearance
end
}
format.json {

View file

@ -17,10 +17,13 @@ class PetState < ApplicationRecord
alias_method :swf_asset_ids_from_association, :swf_asset_ids
scope :glitched, -> { where(glitched: true) }
scope :needs_labeling, -> { unlabeled.where(glitched: false) }
scope :unlabeled, -> { with_pose("UNKNOWN") }
scope :usable, -> { where(labeled: true, glitched: false) }
scope :newest, -> { order(created_at: :desc) }
scope :newest_pet_type, -> { joins(:pet_type).merge(PetType.newest) }
scope :unlabeled, -> { with_pose("UNKNOWN") }
scope :needs_labeling, -> { unlabeled.where(glitched: false) }
# A simple ordering that tries to bring reliable pet states to the front.
scope :emotion_order, -> {
@ -138,5 +141,12 @@ class PetState < ApplicationRecord
end
end
end
def self.next_unlabeled_appearance
# Rather than just getting the newest unlabeled pet state, prioritize the
# newest *pet type*. This better matches the user's perception of what the
# newest state is, because the Rainbow Pool UI is grouped by pet type!
needs_labeling.newest_pet_type.newest.first
end
end

View file

@ -10,6 +10,18 @@
[1]: #{alt_styles_path}
- if support_staff?
%p
%strong 💡 Support summary:
✅ #{number_with_delimiter @counts[:usable]} usable
+ 👾 #{number_with_delimiter @counts[:glitched]} glitched
- if @unlabeled_appearance
+ ❓️
= link_to "#{number_with_delimiter @counts[:needs_labeling]} unknown",
edit_pet_type_pet_state_path(@unlabeled_appearance.pet_type,
@unlabeled_appearance, next: "unlabeled-appearance")
\= #{number_with_delimiter @counts[:total]} total
= form_with method: :get, class: "rainbow-pool-filters" do |form|
%fieldset
%legend Filter by: