Compare commits

..

No commits in common. "f87f4e61b3f048c8c610e7808136913e086a0983" and "bd001e643e4d67e0d9b3e2733571c6b02966837f" have entirely different histories.

7 changed files with 5 additions and 55 deletions

View file

@ -55,9 +55,6 @@
position: relative
z-index: 1
.info
font-size: .85em
.rainbow-pool-pagination
margin-block: .5em
display: flex

View file

@ -13,7 +13,7 @@ class PetTypesController < ApplicationController
end
@pet_types = PetType.
includes(:color, :species, :pet_states).
includes(:color, :species).
order(created_at: :desc).
paginate(page: params[:page], per_page: 30)
@ -59,12 +59,11 @@ class PetTypesController < ApplicationController
#
# If no main poses are available, then we just make all the poses
# "canonical", and show the whole mish-mash!
MAIN_POSES = %w(HAPPY_FEM HAPPY_MASC SAD_FEM SAD_MASC SICK_FEM SICK_MASC)
def group_pet_states(pet_states)
pose_groups = pet_states.emotion_order.group_by(&:pose)
main_groups =
pose_groups.select { |k| PetState::MAIN_POSES.include?(k) }.values
other_groups =
pose_groups.reject { |k| PetState::MAIN_POSES.include?(k) }.values
main_groups = pose_groups.select { |k| MAIN_POSES.include?(k) }.values
other_groups = pose_groups.reject { |k| MAIN_POSES.include?(k) }.values
if main_groups.empty?
return {canonical: other_groups.flatten(1).sort_by(&:pose), other: []}

View file

@ -1,16 +0,0 @@
module PetTypesHelper
def moon_progress(num, total)
nearest_quarter = (4.0 * num / total).round / 4.0
if nearest_quarter >= 1
"🌕️"
elsif nearest_quarter >= 0.75
"🌔"
elsif nearest_quarter >= 0.5
"🌓"
elsif nearest_quarter >= 0.25
"🌒"
else
"🌑"
end
end
end

View file

@ -1,7 +1,5 @@
class PetState < ApplicationRecord
SwfAssetType = 'biology'
MAIN_POSES = %w(HAPPY_FEM HAPPY_MASC SAD_FEM SAD_MASC SICK_FEM SICK_MASC)
has_many :contributions, :as => :contributed,
:inverse_of => :contributed # in case of duplicates being merged

View file

@ -116,23 +116,6 @@ class PetType < ApplicationRecord
"#{color.human_name}-#{species.human_name}"
end
def fully_labeled?
num_missing_poses == 0
end
def num_poses
all_poses = pet_states.map(&:pose)
PetState::MAIN_POSES.count { |pose| all_poses.include? pose }
end
def num_missing_poses
PetState::MAIN_POSES.count - num_poses
end
def num_unlabeled_states
pet_states.count { |ps| ps.pose == "UNKNOWN" }
end
def self.basic_body_ids
PetType.basic.distinct.pluck(:body_id)
end

View file

@ -2,14 +2,3 @@
= link_to pet_type do
= pet_type_image pet_type, :happy, :thumb, class: "preview"
.name= pet_type.human_name
- if support_staff?
.info
- if pet_type.num_unlabeled_states > 0
%span{title: "Unlabeled states"}
❓️ #{pet_type.num_unlabeled_states} +
%span{title: "Labeled main poses"}
- if pet_type.fully_labeled?
✅ #{pet_type.num_poses}/#{pet_type.num_poses}
- else
= moon_progress pet_type.num_poses, pet_type.num_poses + pet_type.num_missing_poses
#{pet_type.num_poses}/#{pet_type.num_poses + pet_type.num_missing_poses}

View file

@ -19,7 +19,7 @@
- if @pet_states[:other].present?
%details
%summary Other
%ul.rainbow-pool-list
%ul.pet-states
= render @pet_states[:other]
- content_for :stylesheets do